static-jsx-webpack-plugin
v0.1.0-alpha.4
Published
Render JSX to static HTML with webpack
Downloads
8
Readme
Static JSX webpack plugin
Use React JSX as entrypoints in webpack and render them to static HTML!
Inspired by:
- https://github.com/unbroken-dome/indexhtml-webpack-plugin
- https://github.com/markdalgleish/react-to-html-webpack-plugin
- https://github.com/markdalgleish/static-site-generator-webpack-plugin
Usage
webpack.config.js
var StaticJsxPlugin = require('static-jsx-webpack-plugin');
module.exports = {
target: 'web',
entry: './index.jsx',
output: {
path: 'dist',
filename: 'bundle.js'
},
module: {
loaders: [{
test: /\.(js|jsx)$/, // You're gonna need a JSX loader.
exclude: /node_modules/, // Babel (babeljs.io) is recommended.
loader: 'babel',
}]
},
plugins: [new StaticJsxPlugin()]
}
Configuration
new StaticJsxPlugin(
{
title: 'Hello world' // Properties for the React component.
},
{
beautify: true // Optional, requires js-beautify. You can
}) // also pass an object with js-beautify options.