halhenke / jade-react-loader

A Jade to React js loader module for Webpack
18 stars 4 forks source link

Jade to React JS loader for Webpack

npm package

PreRequisites

Usage

Like any loader can be set up in a configuration file but to use in a require statement:

var React = require("react");

var template = require("jade-react!./react/components/template.jade");

var JadeComponent = React.createClass({
    render: template
});

Passing Arguments to templates

React.render(React.createElement(JadeComponent, locals), document.getElementById("reactivePlace"));
var React = require("react");

// pass options as json
var template = require("jade-react?{locals: {}, basedir: "", pretty: true}!./react/components/template.jade");

var JadeComponent = React.createClass({
    render: template
});
var React = require("react");
var styles = require('./template.css');

var template = require("jade-react!./react/components/template.jade");

var JadeComponent = React.createClass({
    render: function () {
        return template({styles: styles})
    }
});
section(className=styles.content)
  h1 Hey There!

More Info

Acknowledgements