Premail code style and syntax
Premail uses Husky, internally to format and lint code using Prettier on every git commit. (Prettier is also used on the end-user side, without Husky.)
The following config options are set:
- For Gulp tasks, we use
version 4 syntax
.pipe. Instead of using one-off gulp wrappers, we use
gulp-tapto pass streams as files.
- Handlebars processing happens first in the build process, thus all templates are named as Handlebars files. Within these templates, you will also see MJML, which will be processed second.
- MJML should always be valid under version 4. Use the MJML Try It Live website to test if necessary.
- Sass files use the SCSS syntax to make it easiest on end-users. It is compiled
with Dart Sass and uses
(which does, in fact, work with Dart Sass) to import variables from
configuration files into the Sass files. Because of how Sass maps work, YAML
objects need to defined and passed separately. See
src/tasks/build.jsfor the implementation.
- YAML and Markdown files are wrapped when possible at 80 characters. This is enforced with Prettier.
- Indents are 2 spaces, enforced with