I'm using Ubuntu with Magento 2.2 installed locally for development.
I'm updating my LESS, but it's just not compiling for some reason.
I have all caching turned off in Cache Management, and I run magento setup:static-content:deploy -f after any LESS modifications, but it's still not compiling and showing my changes. I just changed a css padding value from 10 to 11 to test, and it's still set to 10.
I also have caching turned off in my browser, too. And I've ran rm -rf var/view_processed then static content deploy, but that didn't work either.
Also, My Workflow Type is set to Server side less compilation, and the local install of Magento 2 is set to Developer Mode.
So I'm at a loss for what to do to get my LESS to compile into CSS. It's just not doing it for some reason.
Any ideas?
Thank you.
2 Answers 2
Did you delete the compiled file in the pub/static folder first? You should delete those css files (the styles-m.css and the styles-l.css), clear the var/view_preprocessed folder and then run compile.
In some cases, the files in the pub will create sym links to the source file. When that is a the case, you don't have to delete it first, so check the pub folder to see the state of those files (this is a setting in the app/etc/di.xml but it a whole other question to configure this).
If nothing is working after that, you should check the file you are working on itself. You should be editing the:
app/design/frontend/{vendor_namespace}/{theme}/web/css/source/_extend.less
And then if nothing is working check the file permission for the pub
and var folders. While working in development, i run these folder with open permission sudo chmod -R 777 pub/ var/. But note that when you push live, if you are moving these directories directly, these permission might be too open (i push code with git so i don't have to worry about generated file and directories).
-
1Isn't that what
magento setup:static-content:deploy -fis supposed to do? Clear out that pub/static stuff? Or am I wrong?James– James2018年02月09日 16:29:23 +00:00Commented Feb 9, 2018 at 16:29 -
As far as i have tested, Magento doesn't clear any file with that command. Those commands are hard to understand since the M2 implementation is a bit convoluted, but when you deploy, if the file is there in the
pubfolder, compile will skip that file all together.circlesix– circlesix2018年02月09日 16:40:11 +00:00Commented Feb 9, 2018 at 16:40 -
2Gotcha. Using the info you gave me, this command worked:
rm magento2/pub/static/frontend/vendor/default/en_US/css/styles-m.css && rm magento2/pub/static/frontend/vendor/default/en_US/css/styles-l.css && rm -rf var/view_processed && magento setup:static-content:deploy -fthank you!James– James2018年02月09日 16:45:33 +00:00Commented Feb 9, 2018 at 16:45 -
sweet! setting up grunt will help you out a lot here. there are some good sources around, but till then, glad this works for ya.circlesix– circlesix2018年02月09日 16:55:49 +00:00Commented Feb 9, 2018 at 16:55
This should work:
rm -rf var/view_preprocessed
rm -rf pub/static/frontend
You don't have to run setup:static-content:deploy if you are in developer mode.
It's possible that the user created the files in pub/static was different than your webserver user, so the webserver user can't change them.
-
Work by removing the content but takes too much time in loading after that.AbdulBasit– AbdulBasit2021年01月17日 18:42:30 +00:00Commented Jan 17, 2021 at 18:42
Explore related questions
See similar questions with these tags.