new BootstrapEmail(templates, optionsopt)
Creates a new BootstrapEmail instance
Parameters:
templates
(
string
|
Array.<string>
)
Path to file, string containing HTML code or array of filepaths
options
(
Object
)
<optional>Properties
style
(
string
)
<optional>Path to .css or .scss file that should be inlined
head
(
string
)
<optional>Path to .css or .scss file taht should be injected into header
logLevel
(
LOG_LEVEL
)
<optional>Defaults to LOG_LEVEL.INFO
variables
(
Object
)
<optional>Sets default SASS-Variables if not defined otherwise in SCSS-file
- Source:
Members
(static) blockElements :Array.<string>
Array containing all tagnames of block-elements. Block-elements will be compiled differently
- Source:
(static, readonly) defaultVariables :Object
Default variables. Can be overwritten in the constructor
- Source:
(static) DOCTYPE :string
Doctype which will be used for parsed templates
- Source:
(static, constant) LOG_LEVEL :number
Properties:
Name | Type | Description |
---|---|---|
DEBUG |
number |
20 |
INFO |
number |
30 |
WARN |
number |
40 |
ERROR |
number |
50 |
FATAL |
number |
60 |
(static, constant) STYLE_VARIABLES :string
Properties:
Name | Type | Description |
---|---|---|
COLUMNS |
string |
$grid-columns |
CONTAINER_WIDTH |
string |
$container-max-width |
- Source:
(static) voidElements :Array.<string>
Array containing all tagnames of void-elements which cannot contain any
- Source:
(private) _headPath :string
Path to (s)css file which should be injected to
- Source:
(private) _logger :Logger
"Bunyan"-Instance for loggin
- Source:
(private) _stylePath :string
Path to main (s)css file
- Source:
(private) _templates :Array.<{$:cheerio, path:string}>
Contains parsed html-templates which will be compiled
- Source:
(private) _vars :Object
Merged object containing default styling variables
- Source:
Methods
(private) ._compileHtml()
Replaces bootstrap classes with saved workarounds
- Source:
(private) ._injectHead()
Injects content of given head-file into the head of each template
- Source:
(private) ._inlineCss()
Inlines all css classes into style attributes
- Source:
(private) ._loadStyle(stylePath) → {Object|Object}
Loads file from given sourcepath. If file is scss or sass, it will be compiled into css
Parameters:
stylePath
()
- Source:
(private) ._output() → {string|Array.<{path:string, document:string}>}
Prepares user-friendly output structure
- Source:
(private) ._processStyle(stylePath) → {Object}
Loads style and extracts all media queries
Parameters:
stylePath
(
string
)
- Source:
.compile() → {string|Array.<{path: string, document: string}>}
Performs a full compile and returns compiled templates
- Source:
.compileAndSave(filePath)
Performs a full compile and saves documents to given destination
Parameters:
filePath
(
string
)
If only one template is compiled, filePath takes a full path including filename and extension. Otherwise it takes only the directory name and uses the filename from inputfiles
- Source: