Is there a way to make CSS urls dynamic, i.e. make css urls be resolved in runtime?
When using webpack with css and style loaders it does this by transforming css url from this format background-image: url("images/my_img.png") to this background-image: url("' + webpack_require('images/my_img.png') + '"). This way, when css is inlined into the js file, the funcion gets called and the url is resolved at runtime.
My use-case is: I'm working with an application that needs to support virtual directories but I don't know beforehand the names of these virtual directories. My only way of knowing the absolute path for any given file is during runtime.
I've already tried using postcss to change the "url" in css files in a way that would make them dynamic, but when scssify inlines the css into js it calls JSON.stringify, which escapes quotes and "undoes" the string concatenation that would make urls dynamic.
Is there a way to make CSS urls dynamic, i.e. make css urls be resolved in runtime?
When using webpack with css and style loaders it does this by transforming css url from this format
background-image: url("images/my_img.png")to thisbackground-image: url("' + webpack_require('images/my_img.png') + '"). This way, when css is inlined into the js file, the funcion gets called and the url is resolved at runtime.My use-case is: I'm working with an application that needs to support virtual directories but I don't know beforehand the names of these virtual directories. My only way of knowing the absolute path for any given file is during runtime.
I've already tried using postcss to change the "url" in css files in a way that would make them dynamic, but when scssify inlines the css into js it calls JSON.stringify, which escapes quotes and "undoes" the string concatenation that would make urls dynamic.