Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): resolve fonts with space in filename
Browse files Browse the repository at this point in the history
At the moment the uri of the font instead of spaced it will be `%20`, hence we need to decode it first before trying to resolve it.

Fixes #9648
  • Loading branch information
Alan Agius authored and vikerman committed Mar 13, 2019
1 parent eb5643e commit 8d09594
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default postcss.plugin('postcss-cli-resources', (options: PostcssCliResou

const { pathname, hash, search } = url.parse(inputUrl.replace(/\\/g, '/'));
const resolver = (file: string, base: string) => new Promise<string>((resolve, reject) => {
loader.resolve(base, file, (err, result) => {
loader.resolve(base, decodeURI(file), (err, result) => {
if (err) {
reject(err);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,4 +575,24 @@ describe('Browser Builder styles', () => {
const { files } = await browserBuild(architect, host, target, overrides);
expect(await files['styles.css']).toContain('background-image:url(//cdn.com/classic-bg.jpg)');
});

it('supports fonts with space in filename', async () => {
host.writeMultipleFiles({
'src/styles.css': `
@font-face {
font-family: "Font Awesome";
src: url("./assets/fa solid-900.woff2") format("woff2");
}
body {
font-family: "Font Awesome";
}
`,
'src/assets/fa solid-900.woff2': '',
});

const overrides = { extractCss: true };
const { output } = await browserBuild(architect, host, target, overrides);
expect(output.success).toBe(true);
});
});

0 comments on commit 8d09594

Please sign in to comment.