-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
62 lines (60 loc) · 1.72 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const { resolve, join } = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
// Directory in the installed rubin-stule-dictionary where assets, such as
// images like logos and favicons, as available.
const rsdAssetsDir = resolve(
__dirname,
'node_modules/@lsst-sqre/rubin-style-dictionary/assets/'
);
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: {
'rubin-technote': [
'./src/assets/rubin-technote/styles/rubin-technote.scss',
],
},
output: {
filename: 'scripts/[name].js',
path: resolve(__dirname, 'src/documenteer/assets'),
},
plugins: [
new MiniCssExtractPlugin({ filename: '[name].css' }),
new CopyPlugin({
// Copy assets from Rubin Style Dictionary into
// src/documenteer/assets/rsd-assets/
patterns: [
{
from: join(
rsdAssetsDir,
'rubin-imagotype/rubin-imagotype-color-on-black-crop.svg'
),
to: 'rsd-assets',
},
{
from: join(
rsdAssetsDir,
'rubin-imagotype/rubin-imagotype-color-on-white-crop.svg'
),
to: 'rsd-assets',
},
],
}),
],
optimization: { minimizer: [`...`, new CssMinimizerPlugin()] },
module: {
rules: [
{
test: /\.(scss|css)$/i,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true } },
{ loader: 'postcss-loader', options: { sourceMap: true } },
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},
],
},
};