cancel
Showing results for 
Search instead for 
Did you mean: 

Static files are never generated automatically in developer mode

SOLVED

Static files are never generated automatically in developer mode

Static files are never generated automatically in developer mode unless I manually use 'setup:static-content:deploy' command.

 

Following is from Frontend developer guide.

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/templates/template-walkthrough.html

"If you add a new .html template, and then edit it, the changes will not apply until you do the following: delete all files in thepub/static/frontend and var/view_preprocessing directories, then reload the pages. You can delete the files manually or run thegrunt clean:<theme_name> command in CLI. For details about using Grunt in Magento see Installing and configuring Grunt."

 

As the instruction above I can confirm my new template file from my custom theme folder with template hint, but when I delete all files in pub/static/frontend and var/view_processing and flush cache, then reload, all static files are gone, and never coming back.( including blank and luma)

And the only way to get back static files is to use the command, "setup:static-content:deploy".

My current mode is developer.

Is this normal?

 

2 REPLIES

Re: Static files are never generated automatically in developer mode

Re: Static files are never generated automatically in developer mode

I found the solution.

It was pub/static/.htaccess file I was missing.

When I remove pub/static folder manually, I removed .htaccess file.

 

http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-static-view.html

Developer mode only: When you install or enable a new module, it might load new JavaScript, CSS, layouts, and so on. To avoid issues with static files, you must clean the old files to make sure you get all the changes for the new module.

You can clean generated static view files in any of the following ways:

  • Manually by clearing the pub/static and var/view_preprocessed directories and subdirectories. except forpub/static/.htaccess.

    To clear the pub/static directory of all files except .htaccess, enter the following command:
    find . -depth -name .htaccess -prune -o -delete
  • Using the Magento command line. Several commands support an optional parameter --clear-static-content, which cleansgenerated static view files. For example, see Enable or disable modules.
  • In the Magento Admin. Go to System > Tools > Cache Management and click Flush Static Files Cache.