Skip to content

Commit

Permalink
Ignore: url(#...) (behavior property) (parcel-bundler#3887)
Browse files Browse the repository at this point in the history
* Add test

* Fix bug

* Remove .only()
  • Loading branch information
mischnic authored Dec 9, 2019
1 parent 7eab250 commit 9c883cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/core/integration-tests/test/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,23 @@ describe('css', () => {
);
});

it('should ignore url() with IE behavior specifiers', async function() {
let b = await bundle(
path.join(__dirname, '/integration/css-url-behavior/index.css')
);

assertBundles(b, [
{
name: 'index.css',
assets: ['index.css']
}
]);

let css = await outputFS.readFile(path.join(distDir, 'index.css'), 'utf8');

assert(css.includes('url(#default#VML)'));
});

it('should minify CSS when minify is set', async function() {
let b = await bundle(
path.join(__dirname, '/integration/cssnano/index.js'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.index {
behavior: url(#default#VML);
}
3 changes: 2 additions & 1 deletion packages/transformers/css/src/CSSTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default new Transformer({
if (
node.type === 'function' &&
node.value === 'url' &&
node.nodes.length
node.nodes.length > 0 &&
!node.nodes[0].value.startsWith('#') // IE's `behavior: url(#default#VML)`
) {
node.nodes[0].value = asset.addURLDependency(node.nodes[0].value, {
loc: createDependencyLocation(
Expand Down

0 comments on commit 9c883cb

Please sign in to comment.