Skip to content

Commit

Permalink
Extracting stylesheet to separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
Rainer Simon committed Sep 13, 2020
1 parent c24e0d3 commit 2ead294
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 13 deletions.
84 changes: 74 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"babel-loader": "^8.0.6",
"css-loader": "^3.2.0",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.11.2",
"node-sass": "^4.14.1",
"sass-loader": "^8.0.0",
"serialize-javascript": "^3.1.0",
"style-loader": "^1.0.0",
"webpack": "^4.41.0",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.11.0",
Expand Down
8 changes: 6 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require('path');
const fs = require('fs');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const APP_DIR = fs.realpathSync(process.cwd());

Expand Down Expand Up @@ -48,8 +49,8 @@ module.exports = {
}
}
},
{ test: /\.css$/, use: [ 'style-loader', 'css-loader'] },
{ test: /\.scss$/, use: [ 'style-loader', 'css-loader', 'sass-loader' ] }
{ test: /\.css$/, use: [ MiniCssExtractPlugin.loader, 'css-loader'] },
{ test: /\.scss$/, use: [ MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader' ] }
]
},
devServer: {
Expand All @@ -64,6 +65,9 @@ module.exports = {
new HtmlWebpackPlugin ({
inject: 'head',
template: resolveAppPath('public/index.html')
}),
new MiniCssExtractPlugin({
filename: 'recogito.min.css',
})
]
}

0 comments on commit 2ead294

Please sign in to comment.