Skip to content

Commit

Permalink
[Webpack] Add support of SCSS
Browse files Browse the repository at this point in the history
  • Loading branch information
clem committed Apr 9, 2021
1 parent c69fd49 commit 402adf5
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 8 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ A simple 11ty starter template with Nunjucks and Webpack.
## ToDo

- Add support of `11ty-image` to generate images in next-gen formats
- Add support of SASS/SCSS
- Add blog part with navigation
96 changes: 96 additions & 0 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"autoprefixer": "^10.2.5",
"css-loader": "^4.3.0",
"css-minimizer-webpack-plugin": "^1.3.0",
"dart-sass": "^1.25.0",
"eleventy-plugin-svg-contents": "^0.7.0",
"file-loader": "^6.2.0",
"glob": "^7.1.6",
Expand All @@ -40,6 +41,8 @@
"postcss-import": "^14.0.0",
"postcss-loader": "^4.2.0",
"purgecss-webpack-plugin": "^4.0.3",
"sass": "^1.32.8",
"sass-loader": "^11.0.1",
"webpack": "^5.31.2",
"webpack-cli": "^4.6.0",
"webpack-fix-style-only-entries": "^0.6.1"
Expand Down
File renamed without changes.
24 changes: 17 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ const PATHS = {
module.exports = (env, argv) => ({
target: 'web',
entry: {
styles: './src/_assets/css/main.css'
main: './src/_assets/js/main.js',
styles: './src/_assets/scss/main.scss'
},
output: {
chunkLoading: false,
wasmLoading: false,
path: path.resolve(__dirname, '_site')
path: path.resolve(__dirname, '_site/js'),
filename: '[name].js'
},
plugins: [
new MiniCssExtractPlugin({
filename: '/css/main.css'
filename: '../css/main.css'
}),
new FixStyleOnlyEntriesPlugin(),
new PurgeCssPlugin({
Expand All @@ -32,10 +34,18 @@ module.exports = (env, argv) => ({
module: {
rules: [
{
test: /\.css$/i,
include: path.resolve(__dirname, 'src/_assets/'),
exclude: /node_modules/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader']
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
implementation: require('dart-sass'),
},
},
'postcss-loader',
],
},
{
test: /\.(svg|jpg|gif|png)$/,
Expand Down

0 comments on commit 402adf5

Please sign in to comment.