@@ -146,6 +146,48 @@ describe('css', function() {
146146 ) ;
147147 } ) ;
148148
149+ it ( 'should support linking to assets with url() from CSS in production' , async function ( ) {
150+ let b = await bundle ( __dirname + '/integration/css-url/index.js' , {
151+ production : true
152+ } ) ;
153+
154+ assertBundleTree ( b , {
155+ name : 'index.js' ,
156+ assets : [ 'index.js' , 'index.css' ] ,
157+ childBundles : [
158+ {
159+ name : 'index.css' ,
160+ assets : [ 'index.css' ] ,
161+ childBundles : [ ]
162+ } ,
163+ {
164+ type : 'woff2' ,
165+ assets : [ 'test.woff2' ] ,
166+ childBundles : [ ]
167+ }
168+ ]
169+ } ) ;
170+
171+ let output = run ( b ) ;
172+ assert . equal ( typeof output , 'function' ) ;
173+ assert . equal ( output ( ) , 2 ) ;
174+
175+ let css = fs . readFileSync ( __dirname + '/dist/index.css' , 'utf8' ) ;
176+ assert ( / u r l \( [ 0 - 9 a - f ] + \. w o f f 2 \) / . test ( css ) , 'woff ext found in css' ) ;
177+ assert ( css . includes ( 'url(http://google.com)' ) , 'url() found' ) ;
178+ assert ( css . includes ( '.index' ) , '.index found' ) ;
179+ assert ( css . includes ( 'url("data:image/gif;base64,quotes")' ) ) ;
180+ assert ( css . includes ( '.quotes' ) ) ;
181+ assert ( css . includes ( 'url(data:image/gif;base64,no-quote)' ) ) ;
182+ assert ( css . includes ( '.no-quote' ) ) ;
183+
184+ assert (
185+ fs . existsSync (
186+ __dirname + '/dist/' + css . match ( / u r l \( ( [ 0 - 9 a - f ] + \. w o f f 2 ) \) / ) [ 1 ]
187+ )
188+ ) ;
189+ } ) ;
190+
149191 it ( 'should support transforming with postcss' , async function ( ) {
150192 let b = await bundle ( __dirname + '/integration/postcss/index.js' ) ;
151193
0 commit comments