magento2: LESS doesn't compile to CSS in production mode
Preconditions
- Magento 2.1 in production mode
- Varnish
Steps to reproduce
- Make changes to _extend.less
- Run
php bin/magento setup:static-content:deploy fi_FI en_US
Expected result
- LESS changes applied to CSS
Actual result
- LESS code in custom template is compiled to global LESS but not to CSS
The only workaround I’ve found is to set Magento into developer mode and then back to production mode.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 28 (11 by maintainers)
Commits related to this issue
- Merge pull request #5927 from magento-trigger/MC-35778 [TR] Integration failures on Magento 2.3-develop with MariaDB 10.2 — committed to magento/magento2 by fascinosum 4 years ago
The issue should be re-checked on the latest
2.4-developbranch. If its still actual on2.4-developit should be confirmed with the labelReproduced on: 2.4.xDescription and versions should be updated If not the issue should be closedHello Team,
I am also facing same issue when i follow the below scenario
Magento 2 version is: 2.2.3 CE Mode:- Production Css/Js :- if the files are in merged from developer mode
File/path from theme :- app/design/frontend/Custom/demo/web/css/custom.less
Server:- AmazonCloud (magemojo) Result:- These custom.less files changes are not effecting/updating in the respected custom.css in the pub folder.
Again if i switched to developer i am able to see the changes.
Can you provide your thoughts on this.
Thanks
Really curious what causes this issue.
In every (!) installation of mine I’m able to regenerate LESS the following way in developer mode:
as intial step. After that, all I have to do is:
$ rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* pub/static/*That said, I have disabled just a few caches to speed up developing to its most efficiency in my cases, but maybe here is the magic? If you disable
does it work for you with this pattern?
However - you still have Varnish in front. So maybe you just need to flush the cache of varnish or disable it for sorting out the problem. If the right CSS is shown in frontend with Varnish disabled, the problem is varnish - you should try the magento CLI functions of flushing caches, it should clear the cache (by semantic I’d guess) and also clear varnish.
Would love to get some feedback from you as I believe this bug is maybe due to some weird configurations. But just my 2 cents.
Have you tried to clear the view_preprocessed folder with $ rm -rf /var/view_preprocessed? Alternatively you could clear CSS/JS Cache in Backend. Maybe this works for you.