Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
bm-email-templatizer
Advanced tools
Readme
#bmEmailTemplatizer An email template engine that truely works.
##Usage ###Minimal
var bmEmailTemplatizer = require('bm-email-templatizer');
bmEmailTemplatizer
.allLocalesAllFiles()
.then(function(results) {
console.log('results', results);
})
.catch(function(err) {
console.log('error', err);
});
##API ###setOptions parameters: options object returns: bmEmailTemplatizer
###allLocalesAllFiles parameters: none. returns: Promise. resolves: pipeline resolves.
#Options
Option | Type | Description |
---|---|---|
pipeline | Array | list of functions to be run by templatizer. |
paths | Object | See Paths section. |
consolidate | Object | See Consolidate section. |
i18nConfigurations | Object | See i18n configurations section. |
var defaulOptions = {
pipeline: ['compilePug', 'compileSass', 'juiceStyles', 'writeHtml'],
paths: {
base: process.cwd(),
scss: 'scss/index.scss',
locales: 'locales/',
views: 'views/**/*.pug',
compiled: 'compiled'
},
consolidate: {
viewEngine: 'pug',
locals: {},
options: {}
}
}
consolidate.js is used to support a HUGE list of view engines!
Default: {}
view engine locals, can be used to add custom functions to be used while rendering the view. example(rendering handlebar templates through jade):
consolidate: {
locals: {
_raw: function(variableName) {
return String.raw`${variableName}`;
}
}
}
//- jade view
html
body
div
| #{ _raw("{{#if user_name}}") }
div=__('welcome-message')
| #{ _raw("{{/if}}") }
node-i18n is automatically embedded to the view engine.
Default: pug
view engine, check
Default: {}
options sent to view engine
###paths.base
Default: process.cwd()
base path of project. By default it is the current working directory, the directory path node is called from.
###paths.scss
Default: scss/index.scss
Entrance point for scss file. Currently accepts only one entrance point.
###paths.views
Default: views/**/*.pug
path.views
accept a glob pattern (relative or absolute).
###paths.locales
Default: locales/
path.locales
accept a directory path (relative or absolute).
locales Locale file name will be supplied as a directory name to the writeHTML pipeline command
###paths.compiled
Default: compiled
Accepts a string for a folder name relative to the base path.
Used by writeHtml
in the pipeline to write the compiled files into directory.
`{base}/{compiled}/{locale}/{fileName}.html
| Future: accepts an object, with absolute boolean, ext name, and folder path.
##Scss To get the active locale in the scss files, use getActiveLocale();
example:
// index.scss
$language: getActiveLocale();
$direction: if($language == 'ar', rtl, ltr);
html {
direction: $direction;
}
@if $language == 'du' {
.test-class {
color: blue;
}
}
##i18n config config options passed to node-i18n, check here
if i18nConfig.locales
is not passed, they are predicted based on json files in the paths.locales
directory.
i18nConfig.directory
and i18nConfig.register
properties are ignored.
FAQs
create email templates through jade/pug, sass, and locale json files
The npm package bm-email-templatizer receives a total of 21 weekly downloads. As such, bm-email-templatizer popularity was classified as not popular.
We found that bm-email-templatizer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.