-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
56 lines (49 loc) · 1.35 KB
/
webpack.mix.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
/**
* webpack FTW.
*
* @since 1.0.0
*
* @see https://laravel-mix.com/
* @arigato https://github.com/JeffreyWay/
*/
const mix = require( 'laravel-mix' );
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
const wpPot = require( 'wp-pot' );
// Fix for versioning
mix.setPublicPath( 'dist' );
// Fix for fonts
mix.setResourceRoot( '../' );
// Use WordPress jQuery
mix.webpackConfig( {
externals: {
$: 'jQuery',
'jquery': 'jQuery',
'react': 'React'
}
} );
// Main scripts and styles
mix.react( 'assets/js/admin/cfi-admin.js', 'dist/scripts' );
mix.sass( 'assets/css/cfi-admin.scss', 'dist/styles' );
// Version in production
if ( mix.inProduction() ) {
mix.version();
// RTL support.
mix.webpackConfig( {
plugins: [
new WebpackRTLPlugin( {
suffix: '-rtl',
minify: true,
} )
]
} );
// POT file.
wpPot( {
package: 'Contextual Featured Images',
domain: 'cfi',
destFile: 'languages/cfi.pot',
relativeTo: './',
src: [ './**/*.php', '!./includes/libraries/**/*', '!./vendor/**/*', '!./docker/**/*', '!./dotorg/**/*', '!./node_modules/**/*' ],
bugReport: 'https://github.com/zhickson/contextual-featured-images/issues/new',
team: 'Dunktree <[email protected]>',
} );
}