-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,4 @@ Thumbs.db | |
# Folders to ignore | ||
/archive/ | ||
/node_modules/ | ||
/build/ |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const path = require('path'); | ||
const { merge } = require('webpack-merge'); | ||
const { extractScss } = require('./webpack.parts.js'); | ||
|
||
const themePath = path.resolve(__dirname, '../themes/boodark'); | ||
|
||
exports.commonConfig = ({ mode }) => ( | ||
merge( | ||
{ | ||
mode, | ||
devtool: 'source-map', | ||
entry: { | ||
'theme': themePath + '/scss/theme.scss', | ||
'theme-nord': themePath + '/scss/theme-nord.scss', | ||
'theme-teal': themePath + '/scss/theme-teal.scss', | ||
'theme-orange': themePath + '/scss/theme-orange.scss', | ||
}, | ||
output: { | ||
filename: '../../../build/[name].js', | ||
path: themePath + '/css', | ||
}, | ||
}, | ||
extractScss(), | ||
) | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { merge } = require('webpack-merge'); | ||
const { commonConfig } = require('./webpack.common.js'); | ||
const { productionConfig } = require('./webpack.production.js'); | ||
const { developmentConfig } = require('./webpack.development.js'); | ||
|
||
const getConfig = ({ mode }) => { | ||
switch (mode) { | ||
case 'production': | ||
return merge(commonConfig({ mode }), productionConfig()); | ||
case 'development': | ||
return merge(commonConfig({ mode }), developmentConfig()); | ||
default: | ||
throw new Error(`Trying to use an unknown mode, ${mode}`); | ||
} | ||
}; | ||
|
||
module.exports = (env, options) => getConfig({ | ||
mode: options.mode ?? 'production', | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
exports.developmentConfig = () => ({ | ||
name: 'CSS development', | ||
// devtool: 'source-map', | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const autoprefixer = require('autoprefixer'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const RtlCssPlugin = require('rtlcss-webpack-plugin'); | ||
|
||
exports.extractScss = () => ({ | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
MiniCssExtractPlugin.loader, | ||
{ loader: 'css-loader', options: { url: false } }, | ||
{ loader: 'postcss-loader', options: { | ||
postcssOptions: { | ||
plugins: [ autoprefixer() ], | ||
}, | ||
}}, | ||
{ loader: 'sass-loader' }, | ||
], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
new MiniCssExtractPlugin({ | ||
filename: '[name].css', | ||
chunkFilename: '[id].css', | ||
}), | ||
new RtlCssPlugin({ | ||
filename: '[name].rtl.css', | ||
}), | ||
], | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); | ||
|
||
exports.productionConfig = () => ({ | ||
name: 'CSS production', | ||
optimization: { | ||
minimize: true, | ||
minimizer: [ | ||
new CssMinimizerPlugin({ | ||
minify: CssMinimizerPlugin.cssoMinify, | ||
minimizerOptions: { | ||
forceMediaMerge: true, | ||
comments: false, | ||
}, | ||
}), | ||
], | ||
}, | ||
performance: { | ||
hints: 'warning', | ||
maxAssetSize: 285000, | ||
maxEntrypointSize: 570000, | ||
}, | ||
}); |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.