-
Notifications
You must be signed in to change notification settings - Fork 464
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
Feature: Curate / normalize asset path #532
Comments
Some advanced stuff: For instance, test against some whitelist from database or some web service and amend the URL accordingly. Or any other unbelievable use-case. 😄 Also, some server-side code (for example; express in node.js) might be able to leverage this feature differently (by imploding some template strings inside the URL and pre-process it). This will be ultra customization. For the relative paths feature detailed above, that could be written on top of this feature: (pseudo code)
If both Thoughts? |
I wrote this pure Sass proof-of-concept that does something very similar https://github.com/glebm/sass-rewrite-url |
Should this conversation be moved upstream to sass/sass? |
Sounds fair to me. :) |
Yes 👍, but the last time they were not happy about it... Imho this feature is absolutely necessary to publish components that don't assume anything about the project structure. |
My rational is that our number 1 priority is sass feature parity. This may happen one day, but it won't be for a long while. To be honest I'm currently of the opinion that this is the just job of a post processor. Alternatively I believe this or equivalent functionality is offered s by compass and the compass team have decided to support Libsass. |
If I wanted to publish a css library and reference assets (like bootstrap does), this can't be solved solely with post-processors imho. |
I think:
|
While I think this is a usefull feature, I pretty much agree with @xzyfer on this. It is not really a high priority currently. I personally also postprocess urls with another tool (I need to have this possibility anyway in my postprocessor). But I guess we would not be against it if anybody would like to take a lead here to get this implemented properly!? |
LibSass does not support relative paths resolution. Nor does ruby-sass (unless we use Compass). At present, WE tries to resolve the URLs in the post-compilation step by using one base path. This misleads in the scenarios where we have nested imports and the meaning of 'relative path' need to be twisted to justify the outcome. :) Less provides this functionality OOTB. We will have to wait for LibSass to provide this functionality; either sass/libsass#674 or sass/libsass#532 gets addressed;
LibSass does not support relative paths resolution. Nor does ruby-sass (unless we use Compass). At present, WE tries to resolve the URLs in the post-compilation step by using one base path. This misleads in the scenarios where we have nested imports and the meaning of 'relative path' need to be twisted to justify the outcome. :) Less provides this functionality OOTB. We will have to wait for LibSass to provide this functionality; either sass/libsass#674 or sass/libsass#532 gets addressed;
I created a collective ticket to keep track this and other "non-urgent" feature requests, in order to keep the issue tracker a bit more clean for the more 1st aid issues. I would like to encourage everybody interested in this particular feature to add their comments into this closed issue anyway. Thanks for your understanding and your contribution! |
Redirected from: #489 (comment)
Ruby sass 3.4.5, and libsass (latest master); do not curate/normalize the images paths of the output. Less, on the other hand, has two options
--rootpath
and--relative-urls
, which help its compiler fix the asset paths in the generated output (see less/less.js#2084 (comment)).Sass compilers assume that you would write the code keeping the destination paths (of output and images) in mind. Less also has this as a default behavior, but provide that other option as well.
I think some folks would want to code Sass relative to current source file directory, without caring about the output's destination.
One of two ways to go about it:
bool relative_urls (default: false)
, which would cause rewriting the urls relative to the output path, as the parser encounters any path.string rootpath_slug (default: null)
(in addition to relative_urls), which would take relative path from output to input file and apply it to each url to give more control in this kind of scenario: Custom-output-path-aware relative-URLs less/less.js#2084 (comment).The text was updated successfully, but these errors were encountered: