From 8f6df6a5cf9351fb2f5b554d6b05bf68544e0ae5 Mon Sep 17 00:00:00 2001 From: Doug Haber Date: Tue, 21 Jan 2014 21:42:43 -0500 Subject: [PATCH] Split rhino and rhino version of lessc. This lets us have cleaner tests (since we don't need to include the test code in the rhino source). Also sets the stage for sharing lessc code between lessc and rhino less (issue #14) and provides a hook so lesscss-java can have custom js. --- Gruntfile.js | 12 +++++++++++- build.gradle | 12 +----------- build/build.yml | 4 +++- lib/less/rhino.js | 6 +----- test/rhino/test-header.js | 2 ++ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index e371de1c0..f931cadca 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -70,6 +70,15 @@ module.exports = function(grunt) { src: ['<%= build.rhino %>'], dest: 'dist/less-rhino-<%= pkg.version %>.js' }, + // lessc for Rhino + rhinolessc: { + options: { + banner: '/* LESS.js v<%= pkg.version %> RHINO | <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>> */\n\n', + footer: '' // override task-level footer + }, + src: ['<%= build.rhinolessc %>'], + dest: 'dist/lessc-rhino-<%= pkg.version %>.js' + }, // Generate readme readme: { // override task-level banner and footer @@ -234,7 +243,8 @@ module.exports = function(grunt) { // Release Rhino Version grunt.registerTask('rhino', [ - 'concat:rhino' + 'concat:rhino', + 'concat:rhinolessc' ]); // Run all browser tests diff --git a/build.gradle b/build.gradle index 9a68020e9..7042b929a 100644 --- a/build.gradle +++ b/build.gradle @@ -36,23 +36,13 @@ project.ext { testOut = 'out/test' } -javascript.source { - test { - js { - srcDir '.' - include 'test/rhino/test-header.js' - include "dist/less-rhino-${packageProps.version}.js" - } - } -} - task runGruntRhino(type: GruntTask) { gruntArgs = "rhino" } combineJs { dependsOn runGruntRhino - source = javascript.source.test.js.files + source = ["dist/less-rhino-${packageProps.version}.js", "test/rhino/test-header.js","dist/lessc-rhino-${packageProps.version}.js"] dest = file(rhinoTestSrc) } diff --git a/build/build.yml b/build/build.yml index b78a0d063..dd4236b99 100644 --- a/build/build.yml +++ b/build/build.yml @@ -102,7 +102,9 @@ rhino: - <%= build.less.source_map_output %> - <%= build.source_map %> - # append rhino-specific code + +# <%= build.rhinolessc %> +rhinolessc: - <%= build.append.rhino %> diff --git a/lib/less/rhino.js b/lib/less/rhino.js index f4f8ffc4b..0ff7aaf58 100644 --- a/lib/less/rhino.js +++ b/lib/less/rhino.js @@ -1,9 +1,5 @@ /*jshint rhino:true, unused: false */ -/*global name:true, less, loadStyleSheet, initRhinoTest, os */ - -if (typeof initRhinoTest === 'function') { // definition of additional test functions (see rhino/test-header.js) - initRhinoTest(); -} +/*global name:true, less, loadStyleSheet, os */ function formatError(ctx, options) { options = options || {}; diff --git a/test/rhino/test-header.js b/test/rhino/test-header.js index 124db1241..884e5d150 100644 --- a/test/rhino/test-header.js +++ b/test/rhino/test-header.js @@ -11,3 +11,5 @@ function initRhinoTest() { if (str.value === "evil red") { return new(less.tree.Color)("600"); } }; } + +initRhinoTest(); \ No newline at end of file