File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 63
63
"karma-chrome-launcher" : " ^2.2.0" ,
64
64
"mocha" : " ^3.4.2" ,
65
65
"sinon" : " ^2.3.8" ,
66
+ "tmp" : " 0.0.33" ,
66
67
"vinyl-buffer" : " ^1.0.0" ,
67
68
"vinyl-source-stream" : " ^1.1.0" ,
68
69
"vueify" : " ^9.4.1" ,
Original file line number Diff line number Diff line change 1
1
import babelify from 'babelify' ;
2
2
import vueify from 'vueify' ;
3
+ import modulesify from 'css-modulesify' ;
4
+ import tmp from 'tmp' ;
3
5
import { dirs } from '../gulp-tasks/config' ;
4
6
import { customSass } from '../gulp-tasks/compilers.js' ;
5
7
8
+ const cssBundleFile = tmp . fileSync ( ) ;
9
+ const cssStream = fs . createWriteStream ( cssBundleFile . name ) ;
10
+
6
11
export default ( config ) => {
7
12
vueify . compiler . applyConfig ( {
8
13
sass : {
@@ -21,9 +26,25 @@ export default (config) => {
21
26
preprocessors : {
22
27
'**/*.js' : [ 'browserify' ] ,
23
28
} ,
29
+ files : [
30
+ cssBundleFile . name ,
31
+ ] ,
24
32
browserify : {
33
+ output : cssBundleFile . name ,
25
34
debug : true ,
26
35
transform : [ babelify , vueify ] ,
36
+ plugin : [ [ modulesify , {
37
+ global : true ,
38
+ generateScopedName : function ( name , filename ) {
39
+ var matches = filename . match ( / ^ \/ n o d e _ m o d u l e s / ) ;
40
+ if ( matches ) return name ;
41
+ if ( process . env . NODE_ENV === 'production' ) {
42
+ return modulesify . generateShortName ( name , filename ) ;
43
+ } else {
44
+ return modulesify . generateLongName ( name , filename ) ;
45
+ }
46
+ } ,
47
+ } ] ] ,
27
48
} ,
28
49
} ) ;
29
50
} ;
You can’t perform that action at this time.
0 commit comments