Skip to content

Commit

Permalink
fix(@angular/cli): prevent greedy CSS url function capture
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and filipesilva committed Feb 28, 2018
1 parent 3ba6cd8 commit f1304b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/@angular/cli/plugins/postcss-cli-resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default postcss.plugin('postcss-cli-resources', (options: PostcssCliResou

return Promise.all(urlDeclarations.map(async decl => {
const value = decl.value;
const urlRegex = /url\(\s*(?:"([^"]+)"|'([^']+)'|(.+))\s*\)/g;
const urlRegex = /url\(\s*(?:"([^"]+)"|'([^']+)'|(.+?))\s*\)/g;
const segments: string[] = [];

let match;
Expand Down
22 changes: 22 additions & 0 deletions tests/e2e/tests/third-party/material-icons.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {silentNpm, ng} from '../../utils/process';
import {updateJsonFile} from '../../utils/project';
import {expectFileToMatch} from '../../utils/fs';


export default function() {
return Promise.resolve()
.then(() => silentNpm('install', 'material-design-icons@3.0.1'))
.then(() => updateJsonFile('.angular-cli.json', configJson => {
const app = configJson['apps'][0];
app['styles'].push('../node_modules/material-design-icons/iconfont/material-icons.css');
}))
.then(() => ng('build', '--extract-css'))
.then(() => expectFileToMatch('dist/styles.bundle.css', 'Material Icons'))
.then(() => ng(
'build',
'--prod',
'--extract-css',
'--output-hashing=none'
))
.then(() => expectFileToMatch('dist/styles.bundle.css', 'Material Icons'));
}

0 comments on commit f1304b3

Please sign in to comment.