url() params break when wrapping in strings.
See original GitHub issueEnvironment
"linaria": "^1.3.1",
"webpack": "^4.29.6",
Description
Using src: url('../../../assets/Roboto-Medium.ttf');
causes the following error:
ERROR in ./.linaria-cache/src/ui/styles/fonts.linaria.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../../../assets/Roboto-Medium.ttf' in 'C:\Users\ivan\Desktop\myProject\.linaria-cache\src\ui\styles'
Removing the quotes, eg using src: url(../../../assets/Roboto-Medium.ttf);
fixes the issue.
Reproducible Demo
The whole snippet:
import { css } from 'linaria';
export const fonts = css`
:global() {
@font-face {
font-family: 'Roboto';
font-display: block;
src: url(../../../assets/Roboto-Medium.ttf);
font-weight: 700;
}
@font-face {
font-family: 'Roboto';
font-display: block;
src: url(../../../assets/Roboto-Medium.ttf);
font-weight: 500;
}
@font-face {
font-family: 'Roboto';
font-display: block;
src: url(../../../assets/Roboto-Regular.ttf);
font-weight: 400;
}
@font-face {
font-family: 'RobotoMono';
font-display: block;
src: url(../../../assets/RobotoMono-Regular.ttf);
font-weight: 400;
}
}
`;
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How do I break a string in YAML over multiple lines?
Use > most of the time: interior line breaks are stripped out, although you get one at the end: key: > Your long...
Read more >overflow-wrap - CSS: Cascading Style Sheets - MDN Web Docs
Lines may only break at normal word break points (such as a space between two words). anywhere. To prevent overflow, an otherwise unbreakable ......
Read more >wordwrap - Manual - PHP
Wraps a string to a given number of characters using a string break character. ... @param float $width - Width, in pixels, of...
Read more >URL objects - The Modern JavaScript Tutorial
href is the full url, same as url.toString(); protocol ends with the colon character : search – a string of parameters, starts with...
Read more >Render a String with Non-breaking Spaces in React | Pluralsight
Inside formatString() , set isDisplay to true and copy the string in a temporary variable. Search for any empty spaces using the given...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed. Will be released in the next 1.4 beta.
Thanks! The second one was supposed to work, but seems it’s broken. Will fix it.