Lightweight react/preact boilerplate with support for inline CSS, automatic code splitting and async scripts.
npm install preact-boilerplateLightweight preact/react boilerplate with support for inline CSS, automatic code splitting and async scripts.
yarn add preact --dev preact-boilerplate
## to build
./node_modules/preact-boilerplate/run build
--env.title="Your%20Title" (required)
--env.analyze {boolean} (optional, default: false) // launch webpack bundle analyzer
--env.react {boolean} (optional, default: false)
--env.uglify {boolean} (optional, default: true)
--env.template {string} (optional)
--env.inlineCss {boolean} (optional, default: true)
## to dev
./node_modules/preact-boilerplate/run dev
--env.title="Your%20Title"
--env.react {boolean} (optional, default: false)
--env.template {string} (optional)
## sample
// import style from './index.scss'; // global scoped css
import style from './index.local.scss'; // local scoped scss
import {
h,
render
} from 'preact';
## src/Main.js
import AsyncComponent from 'async!./AsyncComponent';
const a = {
b: {
c: {
d: value => value
}
}
};
const App = () => {
return (
render(
## src/AsyncComponent.js
import {
h,
render
} from 'preact';
import image from './files/someImage.png';
export default () => {
return (
{process.env.NODE_ENV && 'production'} is production!
{PRODUCTION && 'production'} is production!
);
};
## output minified html w/ (google style) inline css, bundles and scripts to preload ASAP