-
Notifications
You must be signed in to change notification settings - Fork 689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-cascade-6] @base
statement or base()
function for relative urls in @sheet
.
#11680
Comments
One concern with an independant One potential way around these issues is to adjust the syntax to become something like: @sheet foo base("https://example.com") {
...
} Having the function within
|
Yup, seems like a better syntax to define this. |
@base
statement for relative urls in @sheet
.@base
statement or base()
function for relative urls in @sheet
.
Can the base URL be relative to the file it is in? |
It would be if base was omitted but sometimes that might not be desired. |
@zaygraveyard like this? @sheet sheet1 base("./styles/") {
.box {
background-image: var(--background-image);
}
} |
@romainmenke correct 👍 |
I would also like it to work like this. |
See:
CSS authors often structure their source files in various sub directories.
Other assets (fonts, images, ...) are often described as relative urls.
It helps CSS authors if these relative urls actually make sense in their source code so that they can use IDE features to jump to those files, check that they actually exist, ...
It should be up to tools rewrite those urls so that they still make sense when bundling.
Simply inline stylesheets would alter the outcome of relative urls and even the behavior when custom props are used. (typed vs. untyped custom props for
<url>
have distinct behavior)index.css
something/styles/green.css
This must be inlined as:
While that example is possible to support in tools, there is one that is impossible. When there are assignments to untyped custom props it can't be known statically what the urls should be rewritten to.
index.css
styles/green.css
Image location is :
styles/green.png
Maybe we should have a way of describing the base url that should be used to resolve relative urls in Stylesheets.
Or through a function as suggested by @keithamus
Image location is :
styles/green.png
The text was updated successfully, but these errors were encountered: