diff --git a/package.json b/package.json index 3465816..ade1c88 100644 --- a/package.json +++ b/package.json @@ -29,13 +29,15 @@ "html-webpack-plugin": "^3.2.0", "npm-run-all": "^4.1.3", "rimraf": "^2.6.2", + "sass-webpack-plugin": "^1.0.3", "webpack": "^4.23.1", "webpack-cli": "^3.1.2", "webpack-dev-server": "^3.1.10" }, "scripts": { - "start": "npm-run-all --parallel open:client lift", + "start": "npm run open:client", "start:debug": "npm-run-all --parallel open:client debug", + "start:prod": "npm-run-all --parallel build:prod lift", "open:client": "webpack-dev-server --mode development", "build": "npm run build:prod", "build:dev": "webpack --mode development", diff --git a/webpack.config.js b/webpack.config.js index 4b79938..73048ea 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,14 @@ -const HtmlWebpackPlugin = require('html-webpack-plugin'); +const HtmlWebpackPlugin = require('html-webpack-plugin') +const SassWebpackPlugin = require('sass-webpack-plugin') +const path = require('path') module.exports = { + mode: process.env.NODE_ENV || 'development', entry: { login: './assets/js/login.js' }, output: { - path: __dirname + '/.tmp/public', + path: path.join(__dirname, '/.tmp/public'), filename: '[name].bundle.js' }, module: { @@ -23,7 +26,10 @@ module.exports = { }, plugins: [ new HtmlWebpackPlugin({ - template: 'assets/templates/login.html' - }) + template: 'assets/templates/login.html', + links: [{ rel: 'stylesheet', type: 'text/css', href: 'login.css' }], + filename: path.join(__dirname, '/.tmp/public/login.html') + }), + new SassWebpackPlugin(['assets/styles/login.scss'], process.env.NODE_ENV), ] };