mirror of
https://github.com/less/less.js.git
synced 2026-02-08 14:05:24 -05:00
Fragment handling in data-uri function 1959
The change removes #fragment from filePath before readig the file and adds it back to the end of the generated uri.
This commit is contained in:
@@ -422,6 +422,13 @@ tree.functions = {
|
||||
filePath = mimetype;
|
||||
}
|
||||
|
||||
var fragmentStart = filePath.indexOf('#');
|
||||
var fragment = '';
|
||||
if (fragmentStart!==-1) {
|
||||
fragment = filePath.slice(fragmentStart);
|
||||
filePath = filePath.slice(0, fragmentStart);
|
||||
}
|
||||
|
||||
if (this.env.isPathRelative(filePath)) {
|
||||
if (this.currentFileInfo.relativeUrls) {
|
||||
filePath = path.join(this.currentFileInfo.currentDirectory, filePath);
|
||||
@@ -470,7 +477,7 @@ tree.functions = {
|
||||
buf = useBase64 ? buf.toString('base64')
|
||||
: encodeURIComponent(buf);
|
||||
|
||||
var uri = "\"data:" + mimetype + ',' + buf + "\"";
|
||||
var uri = "\"data:" + mimetype + ',' + buf + fragment + "\"";
|
||||
return new(tree.URL)(new(tree.Anonymous)(uri));
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user