2

I would like to see css changes instantly, without having to return to the command line. I'm in developer mode with all cache disabled, yet I have to remove pub/static var/di and cache directories, recompile dependencies, and run setup:static-content:deploy command for css changes to take effect.
Is there a better way? Can I just make magento monitor css changes and deploy them automatically?

2

http://alanstorm.com/magento_2_less_css

I like Alan Storm's article. It goes through what a front end developer needs to know about LESS and working with Magento 2 front end.

You're previous answer is correct, and Grunt is a great way to go. "Gulp" is similar and apparently even faster at it's job. It's fast, and you can setup at the very minimum a watcher that watches your .less files and when you save the file in an editor it will automatically compile your changes for you. This is only really useful on your local developer machine naturally and on the staging and production server you need to use the Magento 2 commands.

Grunt is very capable of doing more automation tasks for you such as minify files and anything else you want to set it up to do. I also would recommend a chrome plugin called "Auto Reload" through Chrome or Firefox to your project as it too detects changes (you can make it to your css directory). This way Grunt watches and compiles LESS, and auto reload will reload your window automatically when Grunt is finished. You can have it on a separate monitor.

You can also use an awesome tool for Magento such as PHP Storm. Works really well not only for this task but will also help you develop as you wonder where is this random file (usually XML or a PHP / phtml file). Not only can you click and find the files you can also setup compass (and I believe Grunt) watchers through this tool for further automation.

This may sound like a lot of work and configuration to some of you (did to me) but "Give me six hours to chop down a tree and I will spend the first four sharpening the axe." -Abraham Lincoln I still believe it's better the time spent on using tools that save us time in the long run.

0

I think I found a way. Looks like there is way to do it with Grunt tool. For anyone who is wondering: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/css_debug.html#grunt_prereq

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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