Frage

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.

War es hilfreich?

Lösung

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).

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top