diff options
author | Anthony Johnson <aj@ohess.org> | 2019-07-18 08:37:55 +0300 |
---|---|---|
committer | Anthony Johnson <aj@ohess.org> | 2019-07-18 08:37:55 +0300 |
commit | 006921a145cf88d72a8645d7a1990ecf9fb7845a (patch) | |
tree | baeb25ad2fd2f3695040697d26505a9f010f5f5a /webpack.dev.js | |
parent | 0ab76453ac380a0d47f974392d3b7d828b68e274 (diff) |
A few additions for migration to webpack
* Fix issues on paths in build and dev files
* Skip yarn to reduce tooling requirements
* Minify CSS assets in production
* Reduce imports on fonts, hardcode font pieces more. There are problems
with the font family names. Roboto mixin brings in everything as
`Roboto-Slab-Bold`, which won't match local font name of 'Roboto Slab'
* Fix the development instance more:
* Add file watching on reST files
* Execute build docs command after webpack build
Things I'm still not sure about:
- [ ] The actual JS output, I haven't vetted this yet
- [ ] If woff2 and woff are enough for fonts. The NPM packages are missing other formats
Diffstat (limited to 'webpack.dev.js')
-rw-r--r-- | webpack.dev.js | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/webpack.dev.js b/webpack.dev.js index c140874..f7653a8 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -1,20 +1,33 @@ const path = require('path'); const merge = require('webpack-merge'); -const common = require('./webpack.common.js'); const exec = require('child_process').exec; +const FilewatcherPlugin = require('filewatcher-webpack-plugin'); +const WatchPlugin = require('webpack-watch-files-plugin').default; +const ShellPlugin = require('webpack-shell-plugin'); +const common = require('./webpack.common.js'); module.exports = merge(common, { mode: 'development', watch: true, devServer: { - contentBase: path.join(__dirname, 'docs/_build/html'), + contentBase: path.join(__dirname, 'docs/build/html'), + watchContentBase: true, compress: false, port: 7070, - after: function (app, server) { - exec('rm -rf docs/_build && sphinx-build docs docs/_build/html', (err, stdout, stderr) => { - if (stdout) process.stdout.write(stdout); - if (stderr) process.stderr.write(stderr); - }); - } - } -});
\ No newline at end of file + hot: false, + liveReload: true, + publicPath: '/_static/' + }, + plugins: [ + new WatchPlugin({ + files: [ + './docs/**/*.rst', + './docs/**/*.py', + ] + }), + new ShellPlugin({ + onBuildEnd: ['make -C docs html'], + dev: false, + }), + ] +}); |