Mjml: Support for Sass?

Created on 6 Dec 2016  路  2Comments  路  Source: mjmlio/mjml

This is related to https://github.com/mjmlio/mjml/issues/462 for adding styles to the compiled document head.

Is there a way to add scss/sass support for this project? It would be nice to be able to have things like resets and basic global styling. I know you can use the mjml-style to import css files.

Here is what adding this could look like:

reference the compiled css file in the mjml template

<mj-style>
  @import "global.css";
</mj-style>

The scss file to be compiled into css

$link_color: blue;
$link_color_hover: darken($link_color, 10%);

a {
  color: $link_color;
  &:hover {
    color: $link_color_hover
  }
}

These styles would then be inlined into the document.

Most helpful comment

Btw, if you have some nice setup with gulp and sass & mjml feel free to share them, so we'll be happy to add them to the readme !

All 2 comments

Hi there @mklemme ,

I think you'll need some kind of gulp/grunt task to achieve this. MJML need to be about rendering the email and not forcing people to use X or Y framework for templating/styling purpose.

Btw, if you have some nice setup with gulp and sass & mjml feel free to share them, so we'll be happy to add them to the readme !

Was this page helpful?
0 / 5 - 0 ratings