ft-interactive/nunjucks-html-loader

Name: nunjucks-html-loader

Owner: FT Interactive News

Description: Webpack Loader for Nunjucks that returns raw html. Also works with Webpack watching system.

Forked from: ryanhornberger/nunjucks-html-loader

Created: 2017-08-23 09:51:16.0

Updated: 2017-09-18 19:11:47.0

Pushed: 2017-08-23 10:59:20.0

Homepage: null

Size: 14

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Nunjucks (Webpack) HTML Loader

The original 'nunjucks-loader' takes nunjucks templates and turns them into javascript. I wanted to take nunjucks templates and turn them into pre-compiled static html files.

NPM version Github license Github stars

Usage

This is a very simple webpack loader for nunjucks files. It performs the following opteration:

some-template.nunj -> html string

When you mix it with the file-loader you can take it one step further!

some-template.nunj -> html string -> some-file.html

Add your personal variation to the below loader configuration to your webpack config and you should be good to go.

{
    test: /\.nunj$/,
    loader: 'file?context=' + precompiledContext + '&name=[path][name].html!nunjucks-html?' +
        JSON.stringify({
            'searchPaths': [
                '/path/to/sources',
                '/path/to/more/sources'
            ]
        })
}

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.