Whenever I edit app/design/frontend/Dzinehub/Theme/web/css/styles-l.css
, it doesn't get reflected in the front end when I load the site .After every change , I have to clear the cache and run static content-deploy for the changes to appear.Is there any other way ?
5 Answers
You could run: setup:static-content:deploy
OR delete the file(s) manually pub/static/frontend/...
While developing the first approach could be extremely slow so personally I prefer to remove the created files.
You can find a detailed explanation about code clean here
BTW: It is preferable edit .less instead .css files to maintain scalable and 'neat' your theme code.
-
Does this mean I've to clear and run static-content:deploy every time I make a change in the stylesheet? Commented Dec 30, 2015 at 11:49
-
If you set Magento to be in developer mode,"Static view files are not cached; they are written to the Magento pub/static directory every time they’re called" as it describes here: http://devdocs.magento.com/guides/v2.0/config-guide/bootstrap/magento-modes.html
You can set developer mode with cli: bin/magento deploy:mode:set developer
.
Also make sure you've disabled the Magento cache through the admin, and review the link I proved above which talks about the other modes available in Magento 2.
Clear / Flush Magento cache by typing “php bin/magento cache:flush”.
In this step, we are setting up static content to deploy on our Magento store. To perform this, type “php bin/magento setup:static-content:deploy”.
And finally, to Reindex Magento Static Blocks type “php bin/magento indexer:reindex”.
I hope this may work for you. :)
I just found the answer myself , You need to enable the apache server rewrite. Just follow these steps if you are a linux user ,Goto terminal and type
sudo a2enmod rewrite
You need to restart the web server now to apply the changes:
sudo service apache2 restart