automatic generation of dir/files under pub/static not working. When i google about this find that i have to delete that file in which i did change and then run below given command.

php bin/magento setup:static-content:deploy

But there must be another way. because every time i cant run this command when change code in css file. And update css file under pub/static and upload final css file in last under theme and then run content is also not a solution.

i read on stack-overflow about .htaccess file must be under pub/static but that file also not work. it was removed so i add again file under pub/static/.htaccess But it does not work.

  • Please check for file permissions of folder 777 ? – Ankit Shah Dec 19 '16 at 8:23
  • I don't understand. You say that you edit some css file in pub/static and it is overwritten when you run the static content deploy command ? – Marius Dec 19 '16 at 8:23
  • @Marius i mean when i do any changing in example.css in a theme file and run eploy command nothing happen because first i need to that file from pub/static. so when i delete that file and run deploy command. updated css file is woprking means newly genrated file in pub/static have updated code – user3443146 Dec 19 '16 at 9:36
  • @Marius can you help me in my other question magento.stackexchange.com/questions/150923/… – user3443146 Dec 19 '16 at 11:16
  • hi can you help me of this question magento.stackexchange.com/questions/151482/… – user3443146 Dec 22 '16 at 19:42

There are two different scenarios:

  1. developer mode

    • you should not run the command at all (more info: Which compilation commands are needed in developer mode and when? )

    • the original pub/static/.htaccess file is necessary

    • the webserver user must have permissions to create symlinks in pub/static (if you are on Windows, you have to set up permissions first because by default only administrators can create symlinks)

  2. production mode

    • you have to run the deployment command after each change. Period.

Obviously you don't want to develop in production mode.

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.