Skip to content

Try to create theme - But nothing apply #1590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sunilit42 opened this issue Jul 30, 2015 · 32 comments
Closed

Try to create theme - But nothing apply #1590

sunilit42 opened this issue Jul 30, 2015 · 32 comments
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@sunilit42
Copy link
Contributor

Hello,

I am trying to create new theme in magento 2.

I am trying to change background color.

So i copied web/css/source/_theme.less

And change @page__background-color: @Color-White; to @page__background-color: @color-gray19;

But nothing changed into frontend side.

Already removed static files.

Also If i want to add more color code then i need to edit below file?

lib\web\css\source\lib\variables_colors.less

@sunilit42 sunilit42 changed the title Try to create theme Try to create theme - But nothing apply Jul 30, 2015
@gotbahn
Copy link

gotbahn commented Jul 30, 2015

Hello @sunilit42

Seems you are doing everything right, let's try to catch what is wrong, please verify next things:

  • You created new theme with next structure:
app/design/frontend/
├── YourVendorName
│   │   ├──YourThemeName
│   │   │   ├── web
│   │   │   │   ├── css
│   │   │   │   │   ├── source
│   │   │   │   │   │   ├── _theme.less
  • You applied this theme as main in admin Stores -> Configuration -> Design -> Design Theme
  • Chosen your theme, saved configuration and flushed cache
  • Theme is applied and styles for example going from pub/static/frontend/YourVendorName/YourThemeName/...

I suggest problem in of some steps above

Also If i want to add more color code then i need to edit below file?

lib\web\css\source\lib\variables_colors.less

No, you shouldn't work with lib, it would lead to incompatibility.
Instead you can create new styles or override existing.

Example of create new styles for new theme with blank theme parent:

Simple way

Just create source/_extend.less in your theme and add there everything that you need to add new for your theme.

app/design/frontend/
├── YourVendorName
│   │   ├──YourThemeName
│   │   │   ├── web
│   │   │   │   ├── css
│   │   │   │   │   ├── source
│   │   │   │   │   │   ├── _extend.less
Advanced way

Create new parent less files

app/design/frontend/
├── YourVendorName
│   │   ├──YourThemeName
│   │   │   ├── web
│   │   │   │   ├── css
│   │   │   │   │   ├── styles-l.less, styles-m.less

Inside your new parent styles (styles-l.less, styles-m.less) you can add any new styles or imports.

Example of override exisiting styles for new theme with blank theme parent:

Let's say you don't like something that included in Magento 2 lib or sources or predefined theme, as example buttons (why not?). You can simply override existing buttons implementation with create new _buttons.less file in your theme. If path are matched your theme will override default file.

app/design/frontend/
├── YourVendorName
│   │   ├──YourThemeName
│   │   │   ├── web
│   │   │   │   ├── css
│   │   │   │   │   ├── source
│   │   │   │   │   │   ├── _buttons.less

@sunilit42
Copy link
Contributor Author

Hello,

Thanks for good explain but still same issue.

One more thing notice:
Just rename of theme name from pub/static/frontend/PackageName/Themename

When i refresh page all static content not able to create automatically, I already set Developer mode in htaccess.

So everytime i need to run below command:
magento setup:static-content:deploy

@gotbahn
Copy link

gotbahn commented Jul 31, 2015

@sunilit42

Renaming directories seems bad practice, after creation and call theme stored in DB.

DB

I can't reproduce your issue. Can you provide more info please? Add some screenshot with path of static files in debugger or/and created theme structure would be great.

@sunilit42
Copy link
Contributor Author

Hello,

image

Create new theme and name of name demo theme.

Folder stucture of theme is
image

Frontend screenshot:-
image

Now i am trying to change color from @color-gray19 to #ff5501
image

Now refresh page at frontend side
no changes is apply.

So rename static folder or delete it
image

After rename, not able to create all files automatically

untitled

So everytime when i will change something in css, i need to run below command?
magento setup:static-content:deploy

look forward your reply

@gotbahn
Copy link

gotbahn commented Jul 31, 2015

@sunilit42 ok, now I see that theme is created and applied and trying to reach by correct path to pub.

Please verify that this files are missed in pub/static/frontend/Test/mage2... Please delete all renamed folders and 'pub/static' and show what you have after page refresh.

So everytime when i will change something in css, i need to run below command?
magento setup:static-content:deploy

No, you don't need that. Deleting of pub/static/frontend/Test/mage2... enough to rerun all process that generates static files for your theme.

@sunilit42
Copy link
Contributor Author

Already removed static folder

image

Only requirejs folder created after remove it.

@gotbahn
Copy link

gotbahn commented Jul 31, 2015

@sunilit42 gotcha, thank you for detailed screenshots
seems problem is in deletion .htaccess inside pub/static, try to recover it and delete only files that need to be recreated pub/static/frontend/Test/mage2/...

@sunilit42
Copy link
Contributor Author

Hello,

Thanks for that.

What i did, i copied that htaccess file from repository.

But still one css missing- first time load.
image

But second time when i refresh page it is working fine

@sunilit42
Copy link
Contributor Author

Also
image

I changed background color from _theme.css file still not applied after refresh page.

Then i removed static files but still not showing changes.

Anything missing?

@gotbahn
Copy link

gotbahn commented Aug 3, 2015

But still one css missing- first time load.
image

But second time when i refresh page it is working fine

@sunilit42
It's known issue. Less php processing is slow on some environments and catch timeout for second file, so it's generates only for second request. Which gonna be when you refresh page second time.

I believe we have internal ticket for that.

I changed background color from _theme.css file still not applied after refresh page.

Then i removed static files but still not showing changes.

Anything missing?

Doh. Well seems you did everything right, for me hard to say what's wrong. I created new themes couple times during last days and all was fine.

We need plan B. Can you upload your current repo to GitHub? Will try to debug fork directly.

@sunilit42
Copy link
Contributor Author

uploaded theme files on dropbox

https://www.dropbox.com/s/thm0398aivxaglt/Test.zip?dl=0

Thanks for your help

@annapet
Copy link

annapet commented Aug 4, 2015

I had the same situation and I deleted also the folder /var/view_preprocessed, or in backend System/"Cache Managed" clicked on button "Flush Static Files Cache". Maybe it will help.

@sunilit42
Copy link
Contributor Author

this is not a solution..every time when I changed something in CSS then
remove all folder in developer mode
On Aug 4, 2015 9:35 PM, "Anna" [email protected] wrote:

I had the same situation and I deleted also the folder
/var/view_preprocessed, or in backend System/"Cache Managed" clicked on
button "Flush Static Files Cache". Maybe it will help.


Reply to this email directly or view it on GitHub
#1590 (comment).

@annapet
Copy link

annapet commented Aug 4, 2015

I think so too! :)

@sunilit42
Copy link
Contributor Author

waiting for some good answer !!!

@sunilit42
Copy link
Contributor Author

@godban , is there any solution?

@gotbahn
Copy link

gotbahn commented Aug 5, 2015

@sunilit42 as for theme that you provided, I didn't find required <preview_image>media/logo.png</preview_image> preview image. It can break theme generation.

@sunilit42 @annapet

I had the same situation and I deleted also the folder

We found issue with copies of LESS source files that are created instead of symlinks in client side less compilation. That mean there is no chance to apply changes without deleting 'pub/static/frontend' manually now. Sorry about this.
We created internal ticket for that MAGETWO-40652 and will fixed asap.

@vpelipenko vpelipenko added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report and removed question labels Aug 5, 2015
@sunilit42
Copy link
Contributor Author

hey,

any news on this?

@gotbahn
Copy link

gotbahn commented Sep 3, 2015

Hey @sunilit42,
sorry for delay, should be fixed now

@okorshenko
Copy link
Contributor

@sunilit42 Are you still able to reproduce this issue?

@sunilit42
Copy link
Contributor Author

one more question:

if i want to do some small changes into cssm then how i can do directly and test.

Because in magento2, that working based on saas, so it merge all css and creating css file, so much time consuming, how we can do quickly.

@praful-rajput
Copy link

Hello,
Que: How "grunt watch" will work for newly created theme?

I installed Magento ver. 1.0.0-beta.

I have cloned from luma theme as child theme under /app/design/frontend/Vendor/lumaDark

Note: Grunt is installed with necessary tool like [watch] and its working fine.

If I change something from /app/design/frontend/Vendor/lumaDark/Magento_Checkout/web/css/source/module/_minicart.less file. it doesn't showing under Grunt watch from command line.

While If I change it from /pub/static/frontend/Vendor/lumaDark/Magento_Checkout/web/css/source/module/_minicart.less

It showing file changes status in Command Line and less processing has been working fine.

So what is the exact way to work with less as well as grunt watch parallel for run time less processing?

Please help me..

@eug123
Copy link
Contributor

eug123 commented Oct 12, 2015

Hello, @vasuscoin

Have you added your theme (Vendor/lumaDark) to the themes list grunt configuration file
dev/tools/grunt/configs/themes.js?

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html#grunt_prereq

@praful-rajput
Copy link

Hey @eug123
Sorry for delay.
I have added them to dev/tools/grunt/configs/theme.js as well as added to dev/tools/grunt/configs/less.js

@praful-rajput
Copy link

@eug123
I have attached theme.js & less.js screenshot.
less

When execute grunt less:lumaDark or grunt exec:lumaDark or grunt exec:all all these commands are working fine. but issue is mentioned in my first comment.

@eug123
Copy link
Contributor

eug123 commented Oct 12, 2015

Sorry, @vasuscoin

Have skipped info about your magento version.
There is an issue in beta - system creates copies of less files instead of symlinks, so changes in sources are not visible for watcher.
There is a discussion about it
And here is a patch to fix symlink issue in beta - https://gist.github.com/godban/8cb178f9a84ed85f1eac

@praful-rajput
Copy link

@eug123
I tried to install patch. Unfortunately app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php file not found.

Where from I will received this file?

@eug123
Copy link
Contributor

eug123 commented Oct 13, 2015

Hi @vasuscoin
ver. 1.0.0-beta version of this file in the master branch
https://github.com/magento/magento2/blob/master/app/code/Magento/Developer/Test/Unit/Console/Command/CssDeployCommandTest.php

@praful-rajput
Copy link

In which branch we have to work after cloned from https://github.com/magento/magento2 ? develop or master ?
I observed that there are some files & folders are missing in develop branch.
e.g. https://github.com/magento/magento2/tree/master/lib/internal/Magento/Framework/Less is not found into develop branch.

@praful-rajput
Copy link

I got answer for my query at http://devdocs.magento.com/guides/v2.0/install-gde/install/composer-clone.html#instgde-prereq-compose-clone
Thank you.

@sunilit42
Copy link
Contributor Author

When i am using grunt watch command,it showing waiting screen only:
image

@davidalger
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests

8 participants