An open API service indexing awesome lists of open source software.

https://github.com/jsdf/hot-site

convention-over-configuration webpack dev server with hot module replacement and less boilerplate
https://github.com/jsdf/hot-site

Last synced: about 2 months ago
JSON representation

convention-over-configuration webpack dev server with hot module replacement and less boilerplate

Awesome Lists containing this project

README

        

# hot-site
a convention-over-configuration webpack dev server with hot module replacement

πŸ’‘spin up new projects faster and with less boilerplate

## usage

```
npm init
npm install --save hot-site
```

directory structure:
```
your_project/
β”œβ”€β”€ index.html
β”œβ”€β”€ package.json
β”œβ”€β”€ src
β”‚Β Β  └── index.js
└── webpack.config.js
```

`webpack.config.js`:
```js
var makeHotSiteConfig = require('hot-site/makeConfig');

module.exports = makeHotSiteConfig({
// your webpack config here
});
```

`package.json`:
```json
{
"scripts": {
"start": "hot-site"
}
}
```

`index.html`
```html






```

```
npm start
open http://localhost:8080/
```

### opinionated setup: babel, css modules, react-transform-hmr

```
npm install --save [email protected] [email protected] babel-plugin-react-transform react-transform-hmr style-loader css-loader
```

`webpack.config.js`:
```js
var makeHotSiteConfig = require('hot-site/makeConfig');

module.exports = makeHotSiteConfig({
devtool: 'cheap-eval-sourcemap',
module: {
loaders: [
{
test: /\.css$/,
loader: "style-loader!css-loader?modules",
},
{
test: /\.js$/,
loaders: ['babel'],
exclude: 'node_modules',
}
],
},
});
```

`.babelrc`:
```js
{
"stage": 0,
"env": {
"development": {
"plugins": ["react-transform"],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
}
}
}
```