0.9.2 • Published 3 years ago

schwartzman v0.9.2

Weekly downloads
71
License
MIT
Repository
github
Last release
3 years ago

schwartzman

Webpack loader for Mustache. Compiles jsx.mustache files to ReactJS.

in-browser demo

why?!

Because "built-in" server-side prerender of react components requires JS VM — JSX allows for pretty complex expressions. On the other hand, every language has library for rendering Mustache templates[citation needed]. Plus, Mustache is very simple and basic. So simple, that it's easier to write a Mustache-to-JS compiler than a JSX parser for Python/Perl/PHP/Pascal/P

installation

$ npm install --save-dev schwartzman

And add to your webpack.config.js

  • {test: /\.jsx\.mustache$/, loader: "schwartzman"} to module.loaders

    • :warning: if you use partials, you'll need to "wrap" this loader with babel-loader or any other dependency solving loader

      {test: /\.jsx\.mustache$/, loader: "babel-loader!schwartzman"}

  • ".jsx.mustache" to resolve.extensions

module.exports = {
  entry: {
    // ...
  },
  output: {
    // ...
  },
  module: {
    loaders: [
      // ...
      {test: /\.jsx\.mustache$/, loader: "schwartzman"},
    ],
  },
  resolve: {
    extensions: [
      // ...
      ".jsx.mustache",
    ],
    // ...
  }
  // ...
}

supported mustache blocks (with some limitations for attributes):

  • {{ variable }} and {{{ escaped_variables }}}
  • {{# section }}
  • {{^ inverted_section }}
  • {{! comment }}
  • {{> partial }}

development

$ npm i
$ npm test
0.9.2

3 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.0

6 years ago

0.7.6

7 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.0

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0-a

9 years ago

0.2.0

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago