1

I've spent a few days reading complex questions and answers on this topic. I'm looking for clear instructions regarding how to make simple edits like changes to CSS in my magento2 site. Is it possible to do so in production mode? At the moment, I'm unable to see changes to the CSS in BOTH development and production mode. I've tried editing both the style.css file in my theme and the .less file in the theme web/css/source folder. Running commands like

php bin/magento setup:static-content:deploy

isn't doing anything.

0

Make sure you are editing the correct css/less files that are located in app/design/frontend/{vendor}/{theme}/web/css and not the ones in pub/static.

After you make changes, first flush the static files cache and refresh the page cache in Magento admin.

This works in developer mode.

enter image description here

  • is there a command to flush static file cache in production mode or do I have to manually delete the files? – helefa Nov 26 '17 at 21:13
  • @helefa I suggest doing it from admin (see edit) – Lez Nov 26 '17 at 21:17
  • according to this devdocs.magento.com/guides/v2.0/howdoi/clean_static_cache.html, it's only available in dev mode... – helefa Nov 26 '17 at 21:20
  • @helafa You are right. In my opinon you should be in developer mode if you're still making changes to your site. But if you're in production, then use rm -R pub/static/* and rm -R var/view_preprocessed/* from CLI – Lez Nov 26 '17 at 21:28
0

You can use grunt to manage Magento tasks http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/tools/using_grunt.html

http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-topics/css_debug.html

Then use grunt clean - this command will clean all statics file

0

maybe its the client side. Your browser may cached the static files

if you are using browser like chrome, right click, select inspect, select network, and tick checkbox disable cache

hit refresh F5 without closing the inspect

0

I recently had an issue exactly the same. I suggest you try what worked for me and Clear var/view_preprocessed directory and then redeploy using the below commands

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

php bin/magento cache:clean 

php bin/magento cache:flush
  • I think there might be an error in your first command, it would be php bin/magento setup:static-content:deploy en_GB was what worked for me. The --language option needed to not be used – Pierre-Verthume Larivière Oct 21 at 17:30
0

In a production mode you can use the sequence of commands below to regenerate the css files. Specially if you're using less files.

It's not required in developer and default modes.

rm var/view_preprocessed/* pub/static/frontend/* \
  && php bin/magento setup:static-content:deploy en_AU en_US

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.