Update dependencies and add a short README
This commit is contained in:
parent
8f6c70c51b
commit
a6a5d841fd
6
.babelrc
6
.babelrc
|
@ -1,3 +1,7 @@
|
||||||
{
|
{
|
||||||
"presets": ["es2015"]
|
"presets": ["es2015"],
|
||||||
|
"plugins": [
|
||||||
|
"syntax-object-rest-spread",
|
||||||
|
"transform-object-rest-spread"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Hugo + Webpack Boilerplate
|
||||||
|
|
||||||
|
This is a boilerplate for using Hugo as a static site generator and Weback as the
|
||||||
|
asset pipeline.
|
||||||
|
|
||||||
|
It's setup to use post-css and babel for CSS and JavaScript.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Clone this repository and run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
|
Then visit http://localhost:3009/
|
||||||
|
|
||||||
|
To build your static output, use:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploying to netlify
|
||||||
|
|
||||||
|
Push your clone to your own GitHub repo, then start a new netlify project, pick
|
||||||
|
your repository and configure it like this:
|
||||||
|
|
||||||
|
* **Build Command:** npm run build
|
||||||
|
* **Directory:** dist
|
||||||
|
|
||||||
|
Now netlify will build and deploy your site whenever you push to git.
|
|
@ -42,11 +42,18 @@ gulp.task('server', ['build'], (cb) => {
|
||||||
// Start a webpack-dev-server
|
// Start a webpack-dev-server
|
||||||
new WebpackDevServer(webpack(myConfig), {
|
new WebpackDevServer(webpack(myConfig), {
|
||||||
contentBase: './dist',
|
contentBase: './dist',
|
||||||
publicPath: 'http://localhost:3009/',
|
publicPath: '/',
|
||||||
stats: {
|
stats: {
|
||||||
colors: true
|
colors: true
|
||||||
},
|
},
|
||||||
hot: false
|
hot: false,
|
||||||
|
proxy: {
|
||||||
|
"/confirm/*": {
|
||||||
|
bypass: function(req, res, proxyOptions) {
|
||||||
|
return "/pages/confirm/index.html";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}).listen(3009, 'localhost', function(err) {
|
}).listen(3009, 'localhost', function(err) {
|
||||||
if(err) throw new gutil.PluginError('webpack-dev-server', err);
|
if(err) throw new gutil.PluginError('webpack-dev-server', err);
|
||||||
gutil.log('[webpack-dev-server]', 'http://localhost:3009/');
|
gutil.log('[webpack-dev-server]', 'http://localhost:3009/');
|
||||||
|
|
|
@ -19,9 +19,12 @@
|
||||||
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
"babel-plugin-transform-object-rest-spread": "^6.8.0",
|
||||||
"babel-preset-es2015": "^6.9.0",
|
"babel-preset-es2015": "^6.9.0",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
|
"exports-loader": "^0.6.3",
|
||||||
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.9.0",
|
"file-loader": "^0.9.0",
|
||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-babel": "^6.1.2",
|
"gulp-babel": "^6.1.2",
|
||||||
|
"imports-loader": "^0.6.5",
|
||||||
"postcss-cssnext": "^2.7.0",
|
"postcss-cssnext": "^2.7.0",
|
||||||
"postcss-loader": "^0.9.1",
|
"postcss-loader": "^0.9.1",
|
||||||
"style-loader": "^0.13.1",
|
"style-loader": "^0.13.1",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import webpack from 'webpack';
|
import webpack from 'webpack';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import ExtractTextPlugin from "extract-text-webpack-plugin";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
module: {
|
module: {
|
||||||
|
@ -11,17 +12,13 @@ export default {
|
||||||
{ test: /\.json$/, loader: 'json-loader' },
|
{ test: /\.json$/, loader: 'json-loader' },
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
loader: 'style!css?modules!postcss'
|
loader: ExtractTextPlugin.extract("style", "css?importLoaders=1!postcss")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
loader: 'babel',
|
loader: 'babel',
|
||||||
test: /\.js?$/,
|
test: /\.js?$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
query: {
|
query: {cacheDirectory: true}
|
||||||
cacheDirectory: true,
|
|
||||||
presets: ['react', 'es2015'],
|
|
||||||
plugins: ['transform-class-properties', 'transform-object-assign', 'transform-object-rest-spread']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -33,7 +30,8 @@ export default {
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.ProvidePlugin({
|
new webpack.ProvidePlugin({
|
||||||
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
|
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
|
||||||
})
|
}),
|
||||||
|
new ExtractTextPlugin("main.css")
|
||||||
],
|
],
|
||||||
|
|
||||||
context: path.join(__dirname, 'src'),
|
context: path.join(__dirname, 'src'),
|
||||||
|
|
Reference in New Issue