File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -108,4 +108,26 @@ test('css-extract', function (t) {
108108 t . ok ( String ( data ) . indexOf ( String ( source ) ) !== - 1 , 'source is still in built bundle' )
109109 }
110110 } )
111+
112+ t . test ( 'should not extract dynamic insert-css statements, again' , function ( t ) {
113+ t . plan ( 4 )
114+ const sourcePath = path . join ( __dirname , 'source-dynamic-2.js' )
115+
116+ browserify ( sourcePath )
117+ . plugin ( cssExtract , { out : readCss } )
118+ . bundle ( readJs )
119+
120+ function readCss ( ) {
121+ return bl ( function ( err , data ) {
122+ t . ifError ( err , 'no error' )
123+ t . equal ( String ( data ) , '' , 'no css extracted' )
124+ } )
125+ }
126+
127+ function readJs ( err , data ) {
128+ t . ifError ( err , 'no error' )
129+ const source = fs . readFileSync ( sourcePath , 'utf8' )
130+ t . ok ( String ( data ) . indexOf ( String ( source ) ) !== - 1 , 'source is still in built bundle' )
131+ }
132+ } )
111133} )
Original file line number Diff line number Diff line change 1+ var insertCss = require ( 'insert-css' )
2+
3+ insert ( '.foo {}' )
4+
5+ function insert ( foo ) {
6+ insertCss ( foo )
7+ }
You can’t perform that action at this time.
0 commit comments