kilokeith / jade-react-loader

A Jade to React js loader module for Webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jade to React JS loader for Webpack

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
});
  • you will need React loaded in the browser
  • If locals is an object specifying the components props you can then render the template on the page like so:
React.render(React.createElement(JadeComponent, locals), document.getElementById("reactivePlace"));
  • OR by passing options through the loader
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
});

More Info

  • Uses the react-jade package and Jade templates are subject to the same limitations as listed there.
  • Nothing fancy at present
    • no async
    • no queries

About

A Jade to React js loader module for Webpack


Languages

Language:JavaScript 100.0%