3

Magento 2 use less/php lib to compile less to css first run time i created my style named style.less in theme directory(web/css). Magento 2 compiled my file to pub/static/frontend/VendorName/ThemeName/en_US/css/style.css then I edit style.less browser reload nothing change How to apply new change on style.less when edit file? command dev:css:deploy not work

4
  • try putting your file in web/css/source and naming it module.less or _module.less
    – Marius
    Sep 9, 2015 at 9:00
  • 1
  • Do you enable Developer Mode? (you can use bin/magento deploy:mode:show to get current mode and bin/magento deploy:mode:set developer to set)
    – KAndy
    Sep 9, 2015 at 10:16
  • I understand every dev, that does not see this as an option. M2 shipps in "static" mode, which is pretty neat to develop in. "Developer" mode is pretty slow and "Production" mode is hard to update. But the biggest flaw is, that once you change from "static" mode there is no way back. After that you can only change to "Production" or "Development". This is just a bad joke.
    – leedch
    Nov 4, 2016 at 9:24

2 Answers 2

1

First you have to configure compilation of style in admin path given below

Store -> Configuration -> Advanced -> Developer -> Front-end development workflow

change to

Client side less compilation

Then edit your theme styles module wise and other web/css/source (common style)

app/design/frontend/vendor_name/theme_name

run below command to set developer mode

- php bin/magento deploy:mode:set developer

and clear cache and deploy static-content

- php bin/magento cache:clean
- php bin/magento setup:static-content:deploy
0
0

This page in the Magento 2 documentation pretty well covers using Grunt to compile less. http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.