jade-bundle-inject

utility for compiling jade templates from source directory into index.html in destination directory

Usage no npm install needed!

<script type="module">
  import jadeBundleInject from 'https://cdn.skypack.dev/jade-bundle-inject';
</script>

README

bundleJade(src_dir, dest_dir, options) ⇒ Promise

Utitlity to compile all source jade templates and inject them into index.html in destination directory

Kind: global function

Param Type Default Description
src_dir string the source directory to search for jade template files
dest_dir string the destination directory to save index.html after compiling
options object
[options.compileIndex] boolean true expect to compile jade index file as well as templates
[options.indexSrcPath] string "index.html.jade" the name of the index file to inject rendered template bundle into. If options.compileIndex=true this file will be compiled before the templates are injected.

The file itself should contain a comment <!-- :jade templates: -->

Note: indexSrcPath should be relative to src_dir to indicate where to inject the template files.
[options.ignorePaths] array Array["index.html.jade", "index.jade"] ignore these paths when searching for template files in src_dir.

Note: Paths are relative to src_dir
[options.pretty] boolean true whether to prettify the jade rendered output
[options.locals] object data to inject into the templates at compile time keys are the filenames relative to src_dir, values are an object of key:value pairs.

Example

To inject locals into <src_dir>/templates/my-template.html.jade'
use locals: {"templates/my-template.html.jade":{greeting: "Hello World"}}
and refer to it in the template as greeting