-
Notifications
You must be signed in to change notification settings - Fork 72
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
Package name support in HTML and CSS #23
Comments
Wouldn't the presence/installation of a manifest be enough to trigger a change in how HTML and CSS resolve bare paths, similar to the |
I don't think that could for any resource except for the main page. As soon as you have resources that might not be aware of the package name map, like external CSS, or HTML modules, you can't safely have a top-level setting changing their behavior. |
Alternatively, a |
How is that different from a top-level map changing JS path behavior? |
It is different in that you specify the attribute on the individual tag. Just like If you don't specify, or if there's a reserved token to disable it (say, |
Sorry for being unclear; my question was to @justinfagnani's "you can't safely have a top-level setting changing their behavior." - how is it safe for JS but not for HTML/CSS? |
A top-level map doesn't change JS (module) path behavior; there is no existing behavior. It would be unexpected if adding a packagemap all of the sudden changed a |
@matthewp ah, thanks for clarifying the difference. |
Many times, an HTML file is inside the folder for which a JS package is defined. Top level code in that page should have a corresponding "module" id (not ending in If you use an import (or dynamic import) on a module script tag of an HTML page, what's the current module id for scoped package name resolution? In similar AMD scenarios, lacking a way to specify the package/module that an HTML file belongs to, we map the global package scope (or So, I think it would make sense for it to be possible to specify the package that an HTML belongs to. |
This is now a first-class part of the proposal, using |
This proposal covers resolving module specifiers from JS imports and exports, but it doesn't cover an adjacent issue of how to utilize package names from HTML or CSS.
This is important when you're loading resources from a package like stylesheets or non-module script:.
In HTML, "bare specifiers" aren't reserved like they are in JS imports, and are interpreted as relative paths. We need some separate scheme, maybe
package:
to indicate that a path should be resolved though the map:In CSS we have the
url()
function, which could either support the new scheme, or we could add a new function, maybe likeimport()
, to support names:The text was updated successfully, but these errors were encountered: