Giter Site home page Giter Site logo

eymengunay / nunjucks-html-loader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryanhornberger/nunjucks-html-loader

0.0 1.0 0.0 4 KB

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

License: MIT License

JavaScript 100.00%

nunjucks-html-loader's Introduction

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

See it in action with the Epicenter project

This is a small piece on a much larger vision to use webpack for more than compiling javascript. See how I'm using it to precompile a static site:

https://github.com/ryanhornberger/node-epicenter

https://www.npmjs.com/package/epicenter

nunjucks-html-loader's People

Contributors

eymengunay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.