Chatr Boilerplate
James DiGioia
{"presets":["es2015","react"]}
.babelrc
import express from 'express';const app = express();app.use(express.static('public'));app.get('/', (req, res) => {res.set('Content-Type', 'text/html');res.send('<h1>Hello World!</h1>');});app.listen(3000);
server.js
const webpack = require('webpack');module.exports = {entry: ['./client.js'],devtool: 'sourcemap',debug: true,output: {path: 'public/',filename: '[name].min.js',sourceMapFilename: '[name].js.map'},module: {loaders: [{test: /.js$/,loader: 'babel',exclude: /(node_modules)/,}]},plugins: [new webpack.optimize.DedupePlugin(),new webpack.optimize.UglifyJsPlugin({minimize: true})]};
webpack.config.js
const add = (a, b) => a + b;console.log(add(1,2));
client.js
@import "node_modules/bourbon/core/bourbon";@import "node_modules/bourbon-neat/app/assets/stylesheets/neat";@import "base/base";
styles.scss
app.engine('hbs', exphbs({extname: '.hbs'}));app.set('view engine', 'hbs');app.get('/', (req, res) => {res.render('index', {app: '<h1>Hello World!</h1>',state: '{}'})});
handlebars
<!DOCTYPE html><html><head><meta charset="utf-8"><title>Web Chat</title><link href="/styles.css" rel="stylesheet" title="Default Styles"></head><body><div id="app">{{{app}}}</div><script type="text/javascript">window.__INITIAL_STATE__ = {{{state}}}</script><script src="/client.js" charset="utf-8"></script></body></html>
main.hbs