[Pkg-javascript-commits] [less.js] 10/25: Properties merging should work also inside directives #2035

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


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

js pushed a commit to annotated tag v1.7.4
in repository less.js.

commit c9c6ddbdfc4467740f0c4380f88dedb66c4ca525
Author: jurcovicovam <meri at meri.org>
Date:   Fri Jul 25 23:43:16 2014 +0200

    Properties merging should work also inside directives #2035
    
    Fixes issue #2035 - property merge inside @font-face. The _mergeRules function is now called also for directives with rules. It used to be called only for rulesets.
    
    I had to turn off jasmine tests for merge.less, because it was replacing all urls by their assumed full paths. For example, the url(something.eot) was changed into url(http://localhost:8081/test/less/something.eot). The result did not matched with expected css and failed.
    
    Note: I'm not sure why values order in source map changed. It does not seem to be caused by my change, it was failing before I made them.
---
 Gruntfile.js               |  2 +-
 lib/less/to-css-visitor.js |  3 +++
 test/css/merge.css         |  5 +++++
 test/less/merge.less       | 11 +++++++++++
 test/sourcemaps/basic.json |  2 +-
 5 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 9b4e314..deea8fc 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -127,7 +127,7 @@ module.exports = function(grunt) {
       },
       main: {
         // src is used to build list of less files to compile
-        src: ['test/less/*.less', '!test/less/javascript.less', '!test/less/urls.less', '!test/less/empty.less'],
+        src: ['test/less/*.less', '!test/less/merge.less', '!test/less/javascript.less', '!test/less/urls.less', '!test/less/empty.less'],
         options: {
           helpers: 'test/browser/runner-main-options.js',
           specs: 'test/browser/runner-main-spec.js',
diff --git a/lib/less/to-css-visitor.js b/lib/less/to-css-visitor.js
index 53f4ee0..b8137d2 100644
--- a/lib/less/to-css-visitor.js
+++ b/lib/less/to-css-visitor.js
@@ -63,6 +63,9 @@
                 }
                 this.charset = true;
             }
+            if (directiveNode.rules && directiveNode.rules.rules) {
+                this._mergeRules(directiveNode.rules.rules);
+            }
             return directiveNode;
         },
 
diff --git a/test/css/merge.css b/test/css/merge.css
index fe29dc8..0d14aac 100644
--- a/test/css/merge.css
+++ b/test/css/merge.css
@@ -32,3 +32,8 @@
   transform: t1s, t2 t3s, t4 t5s t6s;
   background: b1 b2s, b3, b4;
 }
+ at font-face {
+  font-family: 'MyWebFont';
+  src: url(webfont.eot);
+  src: url('webfont.eot?#iefix') format('embedded-opentype'), url('webfont.woff') format('woff'), format('truetype') url('webfont.ttf'), url('webfont.svg#svgFontName') format('svg');
+}
diff --git a/test/less/merge.less b/test/less/merge.less
index 5b5def3..6fab2fc 100644
--- a/test/less/merge.less
+++ b/test/less/merge.less
@@ -76,3 +76,14 @@
     transform+_:  t6s;
     background+:  b4;
 }
+//it should work also inside @font-face #2035
+ at font-face {
+    font-family: 'MyWebFont';
+    src: url(webfont.eot);
+    src+: url('webfont.eot?#iefix');
+    src+_: format('embedded-opentype');
+    src+: url('webfont.woff') format('woff');
+    src+: format('truetype');
+    src+_: url('webfont.ttf');
+    src+: url('webfont.svg#svgFontName') format('svg');
+}
\ No newline at end of file
diff --git a/test/sourcemaps/basic.json b/test/sourcemaps/basic.json
index ab73305..24d5ce2 100644
--- a/test/sourcemaps/basic.json
+++ b/test/sourcemaps/basic.json
@@ -1 +1 @@
-{"version":3,"file":"sourcemaps/basic.css","sources":["testweb/sourcemaps/imported.css","testweb/sourcemaps/basic.less"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;ACAA;EACE,YAAA;EAJA,UAAA;EAWA,iBAAA;EALA,WAAA;EACA,mBAAA;;AAJF,EASE;AATF,EASM;EACF,gBAAA;;AACA,EAFF,GAEI,KAFJ;AAEE,EAFF,GAEI,KAFA;AAEF,EAFE,GAEA,KAFJ;AAEE,EAFE,GAEA,KAFA;EAGA,UAAA;;AALN;AAAI;AAUJ;EATE,iBAAA;;AADF,EAEE;AAFE,EAEF;AAFF,EAEM;AAFF,EAEE;AAQN,OARE;AAQF,OARM;EACF,gBAAA;;AACA,EAFF,GAEI,KAFJ;AAEE,EAFF,GAE [...]
\ No newline at end of file
+{"version":3,"sources":["testweb/sourcemaps/imported.css","testweb/sourcemaps/basic.less"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;ACAA;EACE,YAAA;EAJA,UAAA;EAWA,iBAAA;EALA,WAAA;EACA,mBAAA;;AAJF,EASE;AATF,EASM;EACF,gBAAA;;AACA,EAFF,GAEI,KAFJ;AAEE,EAFF,GAEI,KAFA;AAEF,EAFE,GAEA,KAFJ;AAEE,EAFE,GAEA,KAFA;EAGA,UAAA;;AALN;AAAI;AAUJ;EATE,iBAAA;;AADF,EAEE;AAFE,EAEF;AAFF,EAEM;AAFF,EAEE;AAQN,OARE;AAQF,OARM;EACF,gBAAA;;AACA,EAFF,GAEI,KAFJ;AAEE,EAFF,GAEI,KAFJ;AAEE,EAFF,GAEI,KAFA;AAE [...]
\ No newline at end of file

-- 
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