Skip to content

wmdmark/precompile-swig-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

recompile-swig-loader for webpack

Exports a Swig template as a compiled template for webpack.

Status

Usage

Documentation: using loaders

Quick start guide

Install this into your project:

$ npm install --save precompile-swig-loader

Make all your .html files compile down to Swig templates by modifying your webpack.config.js file:

/* webpack.config.js */
module.exports = {
  module: {
    loaders: [
      { test: /\.html$/, loader: 'precompile-swig' }
    ]
  },
  ...
};

Then use your Swig templates via swig.run:

var result = swig.run(require('./greet.html'), {greeting: "Hello World!"});

Alternate usage

You can also use it without modifying your config. Just explicitly call it on

your require() call via a prefix:

var result = swig.run(require('precompile-swig!./greet.html'), {greeting: "Hello World!"});

Thanks

precompile-swig-loader © 2015+, Mark Johnson. Released under the MIT License.
Authored and maintained by Mark Johnson.

GitHub @wmdmark  ·  Twitter @wmdmark

About

Swig template loader module for webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published