[Pkg-javascript-commits] [less.js] 178/285: upgrade browserify. Use the promise shim instead of the full node version in the browser.

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:51 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 5796cf29e0f717277750b279ebcda8c90bdb9850
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sat Oct 18 08:34:54 2014 +0100

    upgrade browserify. Use the promise shim instead of the full node version in the browser.
---
 Gruntfile.js              | 3 +++
 lib/less-browser/index.js | 8 +++++---
 package.json              | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index b52fef8..00393c0 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -50,6 +50,9 @@ module.exports = function (grunt) {
         browserify: {
             browser: {
                 src: ['./lib/less-browser/index.js'],
+                options: {
+                    ignore: ["promise"]
+                },
                 dest: 'tmp/less.js'
             }
         },
diff --git a/lib/less-browser/index.js b/lib/less-browser/index.js
index b6420f7..f90d260 100644
--- a/lib/less-browser/index.js
+++ b/lib/less-browser/index.js
@@ -14,6 +14,9 @@ var less;
 var isFileProtocol = /^(file|chrome(-extension)?|resource|qrc|app):/.test(window.location.protocol),
     options = window.less || {};
 
+// shim Promise if required
+require('promise/polyfill.js');
+
 window.less = less = require('../less')();
 var environment = less.environment,
     FileManager = require("./file-manager")(options, isFileProtocol, less.logger),
@@ -26,7 +29,6 @@ require("./log-listener")(less, options);
 var errors = require("./error-reporting")(window, less, options);
 var browser = require("./browser");
 var cache = options.cache || require("./cache")(window, options, less.logger);
-var PromiseConstructor = typeof Promise === 'undefined' ? require('promise') : Promise;
 
 options.env = options.env || (window.location.hostname == '127.0.0.1' ||
                               window.location.hostname == '0.0.0.0'   ||
@@ -224,7 +226,7 @@ if (/!watch/.test(location.hash)) {
 // Get all <link> tags with the 'rel' attribute set to "stylesheet/less"
 //
 less.registerStylesheets = function() {
-    return new PromiseConstructor(function(resolve, reject) {
+    return new Promise(function(resolve, reject) {
         var links = document.getElementsByTagName('link');
         less.sheets = [];
 
@@ -248,7 +250,7 @@ less.modifyVars = function(record) {
 };
 
 less.refresh = function (reload, modifyVars) {
-    return new PromiseConstructor(function (resolve, reject) {
+    return new Promise(function (resolve, reject) {
         var startTime, endTime, totalMilliseconds;
         startTime = endTime = new Date();
 
diff --git a/package.json b/package.json
index 3cccf48..1b6658c 100644
--- a/package.json
+++ b/package.json
@@ -61,7 +61,7 @@
     "matchdep": "~0.3.0",
     "time-grunt": "~0.3.1",
     "browserify": "~3.30.2",
-    "grunt-browserify": "~1.3.1"
+    "grunt-browserify": "~3.0.1"
   },
   "keywords": [
     "compile less",

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