0

I'm new in Magento 2 and I learning it now. I am trying to customize email templates by editing default /app/design/frontend/Vendor/Theme/web/css/email-inline.less file in my theme, but I not understand one thing.

When I commented all lines in this file (and deleted @magento_import), I clear cache and deploy static files for my theme:

grunt clean:Theme && php bin/magento setup:static-content:deploy

After this command invoked successfully, I checked files email-inline.less and email-inline.css in /pub/static/frontend/Vendor/Theme/Locale/css/ directory.

File email-inline.less same as in my theme, but email-inline.css for some reason is not empty.

Why does it happen?

3
  • have you tried grunt less:your_theme ? Jun 30, 2017 at 8:29
  • and are you sure this directory is correct pub/static/frontend/Vendor/Theme/Locale/css ? Jun 30, 2017 at 8:31
  • Yes, of course, this right Jun 30, 2017 at 9:17

2 Answers 2

0

Try to compile one time all themes:

grunt clean && grunt exec && grunt less

Or just on your theme grunt clean:mytheme && grunt exec:mytheme && grunt less:mytheme,

grunt:exec copies in var/view_preprocessed files from Magento 2 project (vendor, app/, lib, ..)

3
  • grunt less do same setup:static-content:deploy. I not right? Jun 30, 2017 at 8:42
  • Try to compile everything to all themes. I had fixed a similar issue with it. grunt:exec is the most important command. I find running grunt commands more stable. Jun 30, 2017 at 10:36
  • I configured grunt and this work great! Thanks! Jun 30, 2017 at 12:14
0

Put all your email styles in

app/design/frontend/Vendor/theme/web/css/source/_email.less

now you need to deploy changes. You can do this via

php bin/magento setup:static-content:deploy

or use grunt

grunt less:your_theme

if you get error about missing files you need to run

grunt exec:your_theme

don't forget your_theme should be under

dev/tools/grunt/configs/themes.js

Here is more information http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/css-topics/css_debug.html

NOTICE. if you still do not see changes it could be just cache issue. To prevent this you need re-deploy with Sign enabled. http://docs.magento.com/m2/ce/user_guide/system/static-file-signature.html

4
  • This is clear, but I not understand why email-inline.css compiled with a empty email-inline.less Jun 30, 2017 at 9:10
  • Are you sure you have no compilation errors? Magento use both files email.less and email-inline.less in Less Processor to collect styles from modules and themes including inherited Jun 30, 2017 at 9:18
  • not sure where is the issue ... here is quick solution... 1. enable developer mode 2. remove email files in pub/static/frontend/...../css/email.css and email-inline.css 3. then just call both files in browser directly. Magento should compile your file on the fly. Jun 30, 2017 at 9:21
  • No, compile on the fly not works. But I found reason of issue: less files cached in /var/view_preprocessed directory and if run grunt clean:var before setup:static-content:deploy - is problem not repeat. Thank you! Jun 30, 2017 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.