]>
git.immae.eu Git - github/shaarli/Shaarli.git/blob - webpack.config.js
1 const path
= require('path');
2 const glob
= require('glob');
5 const TerserPlugin
= require('terser-webpack-plugin');
7 // This plugin extracts the CSS into its own file instead of tying it with the JS.
9 // - not having styles due to a JS error
10 // - the flash page without styles during JS loading
11 const MiniCssExtractPlugin
= require("mini-css-extract-plugin");
13 const extractCss
= new MiniCssExtractPlugin({
14 filename: "../css/[name].min.css",
21 thumbnails: './assets/common/js/thumbnails.js',
22 thumbnails_update: './assets/common/js/thumbnails-update.js',
23 metadata: './assets/common/js/metadata.js',
24 pluginsadmin: './assets/default/js/plugins-admin.js',
26 './assets/default/js/base.js',
27 './assets/default/scss/shaarli.scss',
28 ].concat(glob
.sync('./assets/default/img/*')),
29 markdown: './assets/common/css/markdown.css',
32 filename: '[name].min.js',
33 path: path
.resolve(__dirname
, 'tpl/default/js/')
39 exclude: /node_modules/,
41 loader: 'babel-loader',
53 loader: MiniCssExtractPlugin
.loader
,
55 publicPath: 'tpl/default/css/',
63 test: /\.(gif|png|jpe?g|svg|ico)$/i,
66 loader: 'file-loader',
68 name: '../img/[name].[ext]',
69 publicPath: 'tpl/default/img/',
75 test: /\.(eot|ttf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
76 loader: 'file-loader',
78 name: '../fonts/[name].[ext]',
79 // do not add a publicPath here because it's already handled by CSS's publicPath
80 publicPath: '../default/',
87 minimizer: [new TerserPlugin()],
97 './assets/vintage/js/base.js',
98 './assets/vintage/css/reset.css',
99 './assets/vintage/css/shaarli.css',
100 ].concat(glob
.sync('./assets/vintage/img/*')),
101 markdown: './assets/common/css/markdown.css',
102 thumbnails: './assets/common/js/thumbnails.js',
103 metadata: './assets/common/js/metadata.js',
104 thumbnails_update: './assets/common/js/thumbnails-update.js',
107 filename: '[name].min.js',
108 path: path
.resolve(__dirname
, 'tpl/vintage/js/')
114 exclude: /node_modules/,
116 loader: 'babel-loader',
128 loader: MiniCssExtractPlugin
.loader
,
130 publicPath: 'tpl/vintage/css/',
138 test: /\.(gif|png|jpe?g|svg|ico)$/i,
141 loader: 'file-loader',
143 name: '../img/[name].[ext]',
153 minimizer: [new TerserPlugin()],