[Pkg-javascript-commits] [less.js] 246/285: Fix browserify to be the one to expose less to window

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


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

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

commit 062afacfe0d72b9aaf3d40c6791234470e9b66ba
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sat Nov 1 12:04:54 2014 +0000

    Fix browserify to be the one to expose less to window
---
 Gruntfile.js                     | 6 ++++--
 lib/less-browser/index.js        | 3 ++-
 test/browser/runner-main-spec.js | 3 +++
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index a40aa6a..bd7957a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -48,9 +48,10 @@ module.exports = function (grunt) {
             browser: {
                 src: ['./lib/less-browser/index.js'],
                 options: {
-                    alias: ["promise/polyfill.js:promise"],
+                    exclude: ["promise"],
+                    require: ["promise/polyfill.js"],
                     browserifyOptions: {
-                        standalone: 'less-browser'
+                        standalone: 'less'
                     }
                 },
                 dest: 'tmp/less.js'
@@ -285,6 +286,7 @@ module.exports = function (grunt) {
     // setup a web server to run the browser tests in a browser rather than phantom
     grunt.registerTask('browsertest-server', [
         'browsertest-lessjs',
+        'jasmine::build',
         'connect::keepalive'
     ]);
 
diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js
index 8d847b1..0f38709 100644
--- a/lib/less-browser/index.js
+++ b/lib/less-browser/index.js
@@ -25,7 +25,8 @@ options = addDataAttr(options, script);
 // shim Promise if required
 require('promise/polyfill.js');
 
-window.less = less = require('../less')();
+module.exports = less = require('../less')();
+less.options = options;
 var environment = less.environment,
     FileManager = require("./file-manager")(options, isFileProtocol, less.logger),
     fileManager = new FileManager();
diff --git a/test/browser/runner-main-spec.js b/test/browser/runner-main-spec.js
index 3308fba..3762b95 100644
--- a/test/browser/runner-main-spec.js
+++ b/test/browser/runner-main-spec.js
@@ -1,4 +1,7 @@
 console.warn("start spec");
 describe("less.js main tests", function() {
     testLessEqualsInDocument();
+    it("the global environment", function() {
+      expect(window.require).toBe(undefined);
+    });
 });

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