After flushing the static cache files from the System -> Tools -> Cache Management -> Flush Static Files Cache
from the admin panel…
magento admin panel is looking like below…
and for the solution i have to run the php bin/magento setup:static-content:deploy
command everytime.
When i installed Magento 2, static files were generated automatically and not by running the command.
What i need to do so that it will start generating the static files automatically after i have flushed them from backend? Thanks in advance…
Best Answer
After flushing the static files you have three options in terms of regenerating them:
1) Compile using grunt (Or an alternative JS based less compiler) when working locally on a theme etc
2) Deploy the theme using magento's native setup:static:content-deploy command
3) Server/Client Side compilation
To do option 3, you have to ensure that your environment supports the generation of static files. You can find the setup for these in the nginx.conf.example (if using nginx) and the .htacces.sample (if using apache). For example, the nginx.conf.sample has the following section:
This section essentially routes the request for a file through the
pub/static.php
which in turn generates thepub/static
files with relevant symlinks attached to them (Missing this is most likely the reason yours in not being generated)