-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanner.js
45 lines (38 loc) · 945 Bytes
/
banner.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
const mix = require('laravel-mix');
class Banner {
name() {
return 'banner';
}
/**
* Register the component.
*
* When your component is called, all user parameters
* will be passed to this method.
*
* Ex: register(src, output) {}
* Ex: mix.yourPlugin('src/path', 'output/path');
*
* @param {string} banner
* @return {void}
*
*/
register(banner = '') {
this.config = {
banner : banner || "name:[name], file:[file]",
raw : false,
entryOnly : true
}
}
/*
* Plugins to be merged with the underlying webpack plugins array.
*
* @return {Array|Object}
*/
webpackPlugins() {
if (!mix.inProduction()) {
const webpack = require('webpack');
return new webpack.BannerPlugin(this.config)
}
}
}
mix.extend('banner', new Banner());