[Pkg-javascript-commits] [less.js] 32/285: add banner and setup dist to generate browser output from browserify

Jonas Smedegaard dr at jones.dk
Mon Oct 26 23:23:34 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 a8ded64edbbf2bbfc24bed1d1003e8ed0fc98c04
Author: Luke Page <luke.a.page at gmail.com>
Date:   Sun Mar 2 09:47:32 2014 +0000

    add banner and setup dist to generate browser output from browserify
---
 Gruntfile.js    | 67 +++++++++++++++++++++++++++------------------------------
 bin/lessc       | 21 +++++++++++-------
 build/build.yml | 32 ---------------------------
 3 files changed, 45 insertions(+), 75 deletions(-)

diff --git a/Gruntfile.js b/Gruntfile.js
index 8caa6cb..ff09d0f 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -49,30 +49,22 @@ module.exports = function(grunt) {
     },
 
     browserify: {
-      dist: {
-          files: {
-              'dist/less.js': ['lib/less/browser.js']
-          }
-      },
-      browsertest: {
-          files: {
-              'test/browser/less.js': ['lib/less/browser.js']
-          }
+      browser: {
+          src: ['./lib/less/browser.js'],
+          dest: 'tmp/less.js'
       }
     },
     concat: {
       options: {
         stripBanners: 'all',
-        banner: '<%= meta.banner %>\n\n(function (window, undefined) {',
-        footer: '\n})(window);'
+        banner: '<%= meta.banner %>'
       },
-      // Browser versions
       browsertest: {
-        src: ['<%= build.browser %>'],
+        src: '<%= browserify.browser.dest %>',
         dest: 'test/browser/less.js'
       },
-      stable: {
-        src: ['<%= build.browser %>'],
+      dist: {
+        src: '<%= browserify.browser.dest %>',
         dest: 'dist/less.js'
       },
       // Rhino
@@ -107,8 +99,8 @@ module.exports = function(grunt) {
         banner: '<%= meta.banner %>',
         mangle: true
       },
-      stable: {
-        src: ['<%= concat.stable.dest %>'],
+      dist: {
+        src: ['<%= concat.dist.dest %>'],
         dest: 'dist/less.min.js'
       }
     },
@@ -118,7 +110,8 @@ module.exports = function(grunt) {
       files: {
         src: [
           'Gruntfile.js',
-          'lib/less/**/*.js'
+          'lib/less/**/*.js',
+          'bin/lessc'
         ]
       }
     },
@@ -257,37 +250,46 @@ module.exports = function(grunt) {
     'test'
   ]);
 
+  grunt.registerTask('updateBowerJson', function() {
+    var bowerJson = require('./bower.json');
+    bowerJson.version = grunt.config('pkg.version');
+    fs.writeFileSync('./bower.json', JSON.stringify(bowerJson,null,2));
+  });
+
   // Release
-  grunt.registerTask('stable', [
-    'concat:stable',
-    'uglify:stable',
+  grunt.registerTask('dist', [
+    'browserify:browser',
+    'concat:dist',
+    'uglify:dist',
     'updateBowerJson'
   ]);
 
   // Release Rhino Version
   grunt.registerTask('rhino', [
+    'browserify:rhino',
     'concat:rhino',
     'concat:rhinolessc'
   ]);
-  
-  // Run all browser tests
+
+  // Create the browser version of less.js
+  grunt.registerTask('browsertest-lessjs', [
+    'browserify:browser',
+    'concat:browsertest'
+  ]);
+
+    // Run all browser tests
   grunt.registerTask('browsertest', [
-    'browser',
+    'browsertest-lessjs',
     'connect',
     'jasmine'
   ]);
 
   // setup a web server to run the browser tests in a browser rather than phantom
   grunt.registerTask('browsertest-server', [
-    'browser',
+    'browsertest-less',
     'shell:browsertest-server'
   ]);
 
-  // Create the browser version of less.js
-  grunt.registerTask('browser', [
-    'browserify:browsertest'
-  ]);
-
   // Run all tests
   grunt.registerTask('test', [
     'clean',
@@ -312,9 +314,4 @@ module.exports = function(grunt) {
     'concat:readme'
   ]);
 
-  grunt.registerTask('updateBowerJson', function() {
-     var bowerJson = require('./bower.json');
-     bowerJson.version = grunt.config('pkg.version');
-     fs.writeFileSync('./bower.json', JSON.stringify(bowerJson,null,2));
-  });
 };
diff --git a/bin/lessc b/bin/lessc
index c1abb78..16620aa 100755
--- a/bin/lessc
+++ b/bin/lessc
@@ -35,7 +35,7 @@ var continueProcessing = true,
 
 // calling process.exit does not flush stdout always
 // so use this to set the exit code
-process.on('exit', function() { process.reallyExit(currentErrorcode) });
+process.on('exit', function() { process.reallyExit(currentErrorcode); });
 
 var checkArgFunc = function(arg, option) {
     if (!option) {
@@ -67,19 +67,22 @@ var sourceMapFileInline = false;
 args = args.filter(function (arg) {
     var match;
 
-    if (match = arg.match(/^-I(.+)$/)) {
+    match = arg.match(/^-I(.+)$/);
+    if (match) {
         options.paths.push(match[1]);
         return false;
     }
 
-    if (match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i)) { arg = match[1] }
-    else { return arg }
+    match = arg.match(/^--?([a-z][0-9a-z-]*)(?:=(.*))?$/i);
+    if (match) { arg = match[1]; }
+    else { return arg; }
 
     switch (arg) {
         case 'v':
         case 'version':
             console.log("lessc " + less.version.join('.') + " (Less Compiler) [JavaScript]");
             continueProcessing = false;
+            break;
         case 'verbose':
             options.verbose = true;
             break;
@@ -98,6 +101,7 @@ args = args.filter(function (arg) {
         case 'help':
             require('../lib/less/lessc_helper').printUsage();
             continueProcessing = false;
+            break;
         case 'x':
         case 'compress':
             options.compress = true;
@@ -257,7 +261,6 @@ if (!continueProcessing) {
 }
 
 var input = args[1];
-var inputbase = args[1];
 if (input && input != '-') {
     input = path.resolve(process.cwd(), input);
 }
@@ -345,12 +348,14 @@ var parseLessFile = function (e, data) {
             return;
         } else if (options.depends) {
             for(var file in parser.imports.files) {
-                sys.print(file + " ")
+                if (parser.imports.files.hasOwnProperty(file)) {
+                    sys.print(file + " ");
+                }
             }
             sys.print("\n");
         } else {
             try {
-	        if (options.lint) { writeSourceMap = function() {} }
+            if (options.lint) { writeSourceMap = function() {}; }
                 var css = tree.toCSS({
                     silent: options.silent,
                     verbose: options.verbose,
@@ -380,7 +385,7 @@ var parseLessFile = function (e, data) {
                         }
                     } else {
                         sys.print(css);
-		    }
+            }
 		}
             } catch (e) {
                 less.writeError(e, options);
diff --git a/build/build.yml b/build/build.yml
index 098901e..c179f93 100644
--- a/build/build.yml
+++ b/build/build.yml
@@ -19,12 +19,10 @@ lib_source_map: 'lib/source-map'
 # General
 # =================================
 prepend:
-  browser: ['build/require.js', 'build/browser-header.js']
   rhino:   ['build/require-rhino.js', 'build/rhino-header.js', 'build/rhino-modules.js']
 
 append:
   amd:     build/amd.js
-  browser: ['lib/less/environments/browser.js', '<%= build.lib %>/browser.js']
   rhino:   <%= build.lib %>/rhino.js
 
 
@@ -48,36 +46,6 @@ less:
   browser          : <%= build.lib %>/browser.js
   source_map_output: <%= build.lib %>/source-map-output.js
 
-
-# =================================
-# Browser build
-# =================================
-
-# <%= build.browser %>
-browser:
-
-  # prepend utils
-  - <%= build.prepend.browser %>
-
-  # core
-  - <%= build.less.parser %>
-  - <%= build.less.functions %>
-  - <%= build.less.colors %>
-  - <%= build.less.tree %>
-  - <%= build.less.treedir %> # glob all files
-  - <%= build.less.env %>
-  - <%= build.less.visitor %>
-  - <%= build.less.import_visitor %>
-  - <%= build.less.join %>
-  - <%= build.less.to_css_visitor %>
-  - <%= build.less.extend_visitor %>
-  - <%= build.less.source_map_output %>
-
-  # append browser-specific code
-  - <%= build.append.browser %>
-  - <%= build.append.amd %>
-
-
 # =================================
 # Rhino build
 # =================================

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