Skip to content

Commit

Permalink
Split rhino and rhino version of lessc. This lets us have cleaner tes…
Browse files Browse the repository at this point in the history
…ts (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 less#14) and provides a hook so lesscss-java can have custom js.
  • Loading branch information
dhaber committed Jan 22, 2014
1 parent d203ef3 commit 9b3513b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
12 changes: 11 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -234,7 +243,8 @@ module.exports = function(grunt) {

// Release Rhino Version
grunt.registerTask('rhino', [
'concat:rhino'
'concat:rhino',
'concat:rhinolessc'
]);

// Run all browser tests
Expand Down
12 changes: 1 addition & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 3 additions & 1 deletion build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ rhino:
- <%= build.less.source_map_output %>
- <%= build.source_map %>

# append rhino-specific code

# <%= build.rhinolessc %>
rhinolessc:
- <%= build.append.rhino %>


Expand Down
6 changes: 1 addition & 5 deletions lib/less/rhino.js
Original file line number Diff line number Diff line change
@@ -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 || {};
Expand Down
2 changes: 2 additions & 0 deletions test/rhino/test-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ function initRhinoTest() {
if (str.value === "evil red") { return new(less.tree.Color)("600"); }
};
}

initRhinoTest();

0 comments on commit 9b3513b

Please sign in to comment.