[Pkg-javascript-commits] [less.js] 05/10: Fix the data uri function - was not using the current directory and not working if no mime type is given

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:26:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag v2.1.2
in repository less.js.

commit 06dd4ace45c7d777b51e3fdc41081c10524ec505
Author: Luke Page <luke.a.page at gmail.com>
Date:   Fri Nov 28 17:40:12 2014 +0000

    Fix the data uri function - was not using the current directory and not working if no mime type is given
---
 lib/less/functions/data-uri.js | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/less/functions/data-uri.js b/lib/less/functions/data-uri.js
index dc7b977..dd2304b 100644
--- a/lib/less/functions/data-uri.js
+++ b/lib/less/functions/data-uri.js
@@ -9,20 +9,15 @@ module.exports = function(environment) {
 
     functionRegistry.add("data-uri", function(mimetypeNode, filePathNode) {
 
-        var mimetype = mimetypeNode.value;
-        var filePath = (filePathNode && filePathNode.value);
-
-        var fileManager = environment.getFileManager(filePath, this.context.currentFileInfo, this.context, environment, true);
-
-        if (!fileManager) {
-            return fallback(this, filePathNode || mimetypeNode);
+        if (!filePathNode) {
+            filePathNode = mimetypeNode;
+            mimetypeNode = null;
         }
 
-        var useBase64 = false;
-
-        if (arguments.length < 2) {
-            filePath = mimetype;
-        }
+        var mimetype = mimetypeNode && mimetypeNode.value;
+        var filePath = filePathNode.value;
+        var currentDirectory = filePathNode.currentFileInfo.relativeUrls ?
+            filePathNode.currentFileInfo.currentDirectory : filePathNode.currentFileInfo.entryPath;
 
         var fragmentStart = filePath.indexOf('#');
         var fragment = '';
@@ -31,11 +26,16 @@ module.exports = function(environment) {
             filePath = filePath.slice(0, fragmentStart);
         }
 
-        var currentDirectory = this.currentFileInfo.relativeUrls ?
-            this.currentFileInfo.currentDirectory : this.currentFileInfo.entryPath;
+        var fileManager = environment.getFileManager(filePath, currentDirectory, this.context, environment, true);
+
+        if (!fileManager) {
+            return fallback(this, filePathNode);
+        }
+
+        var useBase64 = false;
 
         // detect the mimetype if not given
-        if (arguments.length < 2) {
+        if (!mimetypeNode) {
 
             mimetype = environment.mimeLookup(filePath);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/less.js.git



More information about the Pkg-javascript-commits mailing list