fix(compiler): Don't strip CSS source maps

Fix CSS source mapping for component by keeping `/*# sourceMappingURL= ... */` and  `/*# sourceURL= ... */` comments.

Relates to <https://github.com/angular/angular-cli/issues/4199>.
This commit is contained in:
Zhicheng Wang
2017-08-12 10:14:25 +08:00
committed by Hans
parent 77747e10c0
commit 64b4be9670
2 changed files with 20 additions and 11 deletions

View File

@ -51,6 +51,14 @@ export function main() {
expect(styleWithImports.styleUrls).not.toContain('http://ng.io/3.css');
});
it('should keep /*# sourceURL... */ and /*# sourceMappingURL... */ comments', () => {
const css =
`/*regular comment*/\n/*# sourceURL=.... */\n/*# sourceMappingURL=... *//*#sourceMappingURL=... */`;
const styleWithSourceMaps = extractStyleUrls(urlResolver, 'http://ng.io', css);
expect(styleWithSourceMaps.style.trim())
.toEqual('/*# sourceURL=.... */\n/*# sourceMappingURL=... *//*#sourceMappingURL=... */');
});
it('should extract "@import url()" urls', () => {
const css = `
@import url('3.css');