Permalink
Browse files

Use local less version

  • Loading branch information...
1 parent bea1125 commit 28582f991f09886f69b977af335283ff3a4f087c @indieisaconcept committed Mar 9, 2013
Showing with 36 additions and 30 deletions.
  1. +1 −1 package.json
  2. +2 −20 tasks/lib/kss.js
  3. +6 −2 tasks/lib/styledocco.js
  4. +27 −7 tasks/styleguide.js
View
@@ -41,7 +41,7 @@
"grunt-lib-contrib": "~0.3.0",
"wrench": "~1.3.9",
"styledocco": "~0.6.1",
- "less": "~1.3.1",
+ "less": "~1.3.3",
"kss": "~0.3.5"
},
"keywords": [
View
@@ -18,25 +18,7 @@ module.exports = {
'use strict';
- var helper = require('grunt-lib-contrib').init(grunt);
-
- // Based on handy compile function in
- // https://github.com/gruntjs/grunt-contrib-compass/blob/master/tasks/compass.js#
- function compile(args, cb) {
-
- var child = grunt.util.spawn({
- cmd: args.shift(),
- args: args
- }, function (error, result, code) {
- cb(error);
- });
-
- child.stdout.pipe(process.stdout);
- child.stderr.pipe(process.stderr);
-
- }
-
- return function (styleguide, done) {
+ return function (styleguide, compile, done) {
var files = styleguide.files,
options = styleguide.options,
@@ -76,7 +58,7 @@ module.exports = {
options.includes = template.include;
grunt.file.mkdir(files.dest);
- compile(args.concat([files.base, files.dest], helper.optsToArgs(options)), done);
+ compile(args.concat([files.base, files.dest]), options, done);
};
View
@@ -8,6 +8,9 @@
'use strict';
+var path = require('path'),
+ base = path.dirname(path.dirname(require.resolve('styledocco')));
+
module.exports = {
init: function (grunt) {
@@ -16,12 +19,13 @@ module.exports = {
// proecessor specific arguemnts
processors = {
- 'sass': 'sass --compass'
+ 'sass': 'sass --compass',
+ 'less': base + '/.bin/lessc'
},
_ = grunt.util._;
- return function (styleguide, callback) {
+ return function (styleguide, compile, callback) {
var files = styleguide.files,
options = styleguide.framework && styleguide.framework.options || {},
View
@@ -17,7 +17,7 @@ module.exports = function(grunt) {
var fs = require('fs'),
path = require('path'),
- helpers = require('grunt-lib-contrib').init(grunt),
+ helper = require('grunt-lib-contrib').init(grunt),
plugin = {},
_;
@@ -36,6 +36,26 @@ module.exports = function(grunt) {
util: {
+ // Based on handy compile function in
+ // https://github.com/gruntjs/grunt-contrib-compass/blob/master/tasks/compass.js#
+
+ compile: function(args, options, cb) {
+
+ args = !_.isArray(args) ? [args] : args;
+ args = options && args.concat(helper.optsToArgs(options)) || args;
+
+ var child = grunt.util.spawn({
+ cmd: args.shift(),
+ args: args
+ }, function (error, result, code) {
+ cb(error);
+ });
+
+ child.stdout.pipe(process.stdout);
+ child.stderr.pipe(process.stderr);
+
+ },
+
get: {
paths: function (/* Array, Object */ collection, /* String */ base) {
@@ -76,10 +96,10 @@ module.exports = function(grunt) {
try {
framework = require('./lib/' + name);
- framework = framework.init(grunt);
+ framework = framework.init(grunt);
} catch(err) {
- grunt.fail.warn('Unsupported styleguide framework, see https://github.com/indieisaconcept/grunt-styleguide');
- }
+ grunt.fail.warn(err + '\n' + 'See https://github.com/indieisaconcept/grunt-styleguide');
+ }
return framework;
@@ -201,21 +221,21 @@ module.exports = function(grunt) {
file: file,
src: files.length > 0 && files || grunt.file.exists(file.orig.src) && file.orig.src,
dest: file.dest,
- base: helpers.findBasePath(files)
+ base: helper.findBasePath(files)
};
// make include paths relative
template.include = plugin.util.get.paths(template.include, file.dest);
- // identify the preporcess to use
+ // identify the preprocessor to use
styleguide.preprocessor = plugin.util.get.preprocessor(files);
if(_.isEmpty(styleguide.files.src)) {
grunt.fail.warn('Unable to generate styleguide; no valid source files were found.');
}
- generator(styleguide, function(error) {
+ generator(styleguide, plugin.util.compile, function(error) {
var msg = 'DEST: ' + styleguide.files.dest + '/index.html';

0 comments on commit 28582f9

Please sign in to comment.