diff --git a/package.json b/package.json index a6db802..6597104 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "description": "The official site for [Up](https://github.com/start/up), a lightweight markup language for writing structured content for the web.", "scripts": { - "start": "webpack-dev-server --content-base docs/ --inline --hot --host 0.0.0.0", + "start": "webpack-dev-server", "build": "rm -f docs/{index.html,*.js} && webpack" }, "repository": { diff --git a/webpack.config.js b/webpack.config.js index 73d2091..e95b286 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,18 +2,20 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') const fs = require('fs') const Up = require('up-lang') const upSettings = require('./src/upSettings') -const { resolve } = require('path') +const path = require('path') const documentationMarkup = - fs.readFileSync(sourceDir('content/documentation.up'), 'utf-8') + fs.readFileSync(fromSourceDir('content/documentation.up'), 'utf-8') const renderedUp = Up.parseAndRenderWithTableOfContents(documentationMarkup, upSettings) +const outputDir = path.resolve('./docs'); + module.exports = { - entry: sourceDir('app.js'), + entry: fromSourceDir('app.js'), output: { - path: resolve('./docs'), + path: outputDir, filename: 'bundle-[hash].js' }, module: { @@ -44,19 +46,25 @@ module.exports = { test: /\.up$/, use: 'raw-loader', } - ] + ], }, plugins: [ new HtmlWebpackPlugin({ - template: sourceDir('layout/index.hbs'), + template: fromSourceDir('layout/index.hbs'), documentationHtml: renderedUp.documentHtml, tableOfContentsHtml: renderedUp.tableOfContentsHtml, inject: 'head' }) - ] + ], + devServer: { + contentBase: outputDir, + compress: true, + port: 9000, + open: true + } } -function sourceDir(path) { - return './src/' + path +function fromSourceDir(pathAndFilename) { + return path.resolve('src', pathAndFilename) }