Skip to content

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

License

Notifications You must be signed in to change notification settings

ryanhornberger/nunjucks-html-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'
			]
    	})
}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •