Skip to content
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

Relative path is applied to data:image url #2360

Closed
mtscout6 opened this issue Dec 31, 2014 · 1 comment · Fixed by #2361
Closed

Relative path is applied to data:image url #2360

mtscout6 opened this issue Dec 31, 2014 · 1 comment · Fixed by #2361

Comments

@mtscout6
Copy link
Contributor

I am converting to webpack for my asset management and ran into a problem with the svg-gradient function. I was previously using less@1.7.4, but have recently upgraded to less@2.1.2.

I have a mixins.less file in a nested directory with:

.plan-gradient(@color){
  background: svg-gradient(to bottom,
    fade(@color, 0%) 0%,
    fade(@color, 5%) 60%,
    fade(@color, 10%) 70%,
    fade(@color, 15%) 73%,
    fade(@color, 20%) 75%,
    fade(@color, 25%) 80%,
    fade(@color, 30%) 85%,
    fade(@color, 35%) 88%,
    fade(@color, 40%) 90%,
    fade(@color, 45%) 95%,
    fade(@color, 50%) 100%
  );
}

The problem I have is that the folder in which the mixin resides is getting appended to within the url, like so:

background: url(oe-bootstrap/'data:image/svg+xml,base64,PD9.....');

I believe the offending code is in lib/less/tree/url.js Lines 26-31 since that if gaurd is not checking is the url is a data-url. I will follow up with a pull request unless there is a larger issue I am not seeing.

I originally reported this issue as webpack-contrib/less-loader#30.

mtscout6 added a commit to mtscout6/less.js that referenced this issue Dec 31, 2014
mtscout6 added a commit to mtscout6/less.js that referenced this issue Dec 31, 2014
I don't entirely understand how the tests are setup, so there are some
failing tests still but they appear to be isolated to base64 encoding
options.
@mtscout6
Copy link
Contributor Author

The change in 94b3795 fixes my issue, but I don't know how to get all the tests green. There appears to be an issue around the base64 encoding option. I'm sure it's just a test setup issue, any suggestions on how to setup that test properly?

mtscout6 added a commit to mtscout6/less.js that referenced this issue Dec 31, 2014
I figured out that the test would still fail if I call the import in the
urls.less file. That way I don't need to figure out all the setup
required to test this bug.

- less#2360
lukeapage added a commit that referenced this issue Jan 1, 2015
…sing a Quoted type instead of an anonymous one, since the url is quoted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant