-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.injector.dev.js
61 lines (53 loc) · 1.79 KB
/
webpack.injector.dev.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
'use strict';
/**
* @fileOverview workflow example
*/
// ----------------------------------------
// Imports
// ----------------------------------------
const injector = require('./index');
const autoprefixer = require('autoprefixer');
const cssMqPacker = require('css-mqpacker');
const sortCssMediaQueries = require('sort-css-media-queries');
// ----------------------------------------
// Public
// ----------------------------------------
injector.app('./src/js/app.js', './dist/js/bundle-app.js')
.publicPath('/dist/js/')
.external({ jquery: 'jQuery' })
.sourcemaps(injector.isProduction ? false : 'eval-source-map')
.sass('./src/sass/style.scss', './dist/css/bundle-style.css')
.sass('./src/sass/common.scss', './dist/css/bundle-common.css')
.cssLoaderOptions({
url: false
})
.postcssLoaderPlugin(autoprefixer({
browsers: ['> 1%', 'ie 11'],
cascade: false
}))
.postcssLoaderPlugin(cssMqPacker({
sort: sortCssMediaQueries
}))
.postcssLoaderPlugin(injector.isProduction ? require('cssnano')({
preset: ['default', {
zindex: false,
autoprefixer: false,
reduceIdents: false,
discardUnused: false,
cssDeclarationSorter: false, // disable plugin
postcssCalc: false, // disable plugin
discardComments: { // custom plugin config
removeAll: true
}
}]
}) : null);
injector.helpers.copy('./node_modules/jquery/dist/jquery.min.js', './public/assets/js/vendors/jquery.js', true);
injector.helpers.copy('./src/js/app.js', './dist/js/app.js', true);
injector.helpers.copy('./node_modules/webpack/readme.md', './dist/TEST.md', true);
// console.log(injector.__defaults);
// console.log('--------------');
// console.log(injector.exportConfig());
// ----------------------------------------
// Exports
// ----------------------------------------
module.exports = injector.exportConfig();