0

I am currently working on a theme that I have used and have been changing the templates and styles following the detailed guides over at the Magento2 site.

However, I am really struggling to make progress and am not quite sure what I am doing wrong.

From my understanding of the documentation I can use server side compilation and Grunt to make the changes necessary to progress my developments.

This sounds great, so I installed Grunt and that is working fine, but my issue is that I keep getting loads of 404 errors around pub/static files not existing.

This is strange as from my understanding these files should be generated automatically.

What seems to work is when I run:

php bin/magento setup:static-content:deploy en_GB

But, I don't want to do that each time and it also means that when I run:

grunt watch:theme_name

No changes are detected.

A couple of notes to try and help understand where I have come from:

  • I am in developer mode
  • I have cleared the contents of var and pub/static
  • I am on Magento 2.0.7 updated via composer
  • I have run php bin/magento setup:upgrade
  • I also get the same 404 errors when I access the admin area
  • I have run grunt refresh, grunt exec:all and grunt less to compile all less, but still have the same issues
  • Some digging around seemed to point to symlinks, but I have not been able to work it out

I am sure there is one small thing I am missing or not doing. If anyone could help that would be great as I am tearing my hair out.

1

Run php bin/magento setup:static-content:deploy to generate files for admin. After you run grunt clean or grunt exec pub/static files are deleted.

Also make sure you have right file permissions for pub/static.

What I'm doing on my localhost(windows 7) to develop a theme is following:

  • if I'm getting erros in browser console for missing files I execute php bin/magento setup:static-content:deploy locale_locale
  • run grunt exec:my_theme
  • run grunt watch:my_theme

If I'm adding some css files to theme I need to re-do static-content:deploy again in order to move this files to pub/static

  • thanks for the advice. It looks like the step to deploy again when adding a less file has done the trick and now the 'grunt watch' task is working. Thanks for the tips. – Adam Stacey Jun 1 '16 at 14:03
  • @AdamStacey you're welcome ;) – Vasilii Burlacu Jun 2 '16 at 6:59
0

Run your console as administrator, I never use deploy.

Grunt clean Grunt exec:themename Grunt less:themename or Grunt watch

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.