Similar to SO Question and this.
Specific scenario -- using web workbench plugin for Visual Studio, writing some sassy files which include urls to assets, e.g.
/assets/plugins/PLUGINA/styles/somecssfile.scss
references background images in.../assets/plugins/PLUGINA/images/SOMEIMAGE.png
like...background-image: url(images/SOMEIMAGE.png)
But when using the .NET Optimization Bundling and Minification I bundle multiple css files (the output from WWB) to a new relative path like /assets/styles
, it "breaks" the url path from the underlying stylesheet because the browser sees /assets/styles/images/SOMEIMAGE.png
instead of where it actually resides.
Having a function or variable is really a convenience to needing to redeclare a $current-path
placeholder in every file, so I can then declare
.a-rule { background-image: url(relativeToHere('images/SOMEIMAGE.png')); }
rather than
$relativePath: '/assets/foo/bar/bast';
.a-rule { background-image: url(#{$relativePath}/images/SOMEIMAGE.png'); }
etc
Status: New
|