-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Many CSS features involve referring to assets outside the stylesheet using URLs: plain CSS @imports, background images, and so on. It's not always obvious how these assets will map to URLs on the server, though. Currently Sass provides no built-in support for this mapping, but doing so would be very useful.
I think Sass implementations should expose the ability for users to define their own URL-resolution logic that's invoked for every url() and every plain-CSS @import. This should be done through a JS API that's shared between Dart Sass and Node Sass, as well as a Dart API for Dart Sass users who invoke it via Dart.
I also think it would be valuable to provide some built-in resolution strategies that are available via the command line and through JS/Dart as standardized resolvers. For example, we might want to provide the ability to resolve URLs to data: URLs that embed the document directly, or to map directories on the filesystem to URLs that will be served.