Permalink
Browse files

Don't try to compile .lessignore into .css

This happened when there was a .lessignore file present in the srcDir when
autoless was started.
  • Loading branch information...
1 parent 9d9f496 commit 5c0bd1506953d1630bb13beae1815621dfae380d @jgonera committed Mar 21, 2013
Showing with 16 additions and 3 deletions.
  1. +9 −3 lib/manager.js
  2. +7 −0 test/manager_test.js
View
@@ -2,6 +2,8 @@ var path = require('path');
var EventEmitter = require('events').EventEmitter;
var LessFile = require('./lessfile');
+var ignoreRe = /\.lessignore$/;
+
function Manager(srcDir, dstDir) {
// strip "./" from the beginning for dstFile path generation to work
this.srcDir = srcDir.replace(/^\.\//, '');
@@ -41,7 +43,11 @@ Manager.prototype.addFiles = function(files, callback) {
}
files.forEach(function(file) {
- self._update(file, done);
+ if (!ignoreRe.test(file)) {
+ self._update(file, done);
+ } else {
+ done();
+ }
});
};
@@ -86,7 +92,7 @@ Manager.prototype.compileAll = function(callback) {
Manager.prototype.check = function(file, callback) {
var self = this;
- if (/\.lessignore$/.test(file)) {
+ if (ignoreRe.test(file)) {
this.emit('ignore', file);
this.ignore = true;
}
@@ -106,7 +112,7 @@ Manager.prototype.remove = function(file) {
delete this.files[file];
delete this.dependencies[file];
- if (/\.lessignore$/.test(file)) {
+ if (ignoreRe.test(file)) {
this.emit('resume', file);
this.ignore = false;
}
@@ -29,6 +29,13 @@ describe("Manager", function() {
done();
});
});
+
+ it("skips .lessignore", function(done) {
+ manager.addFiles(['test/less/.lessignore'], function() {
+ manager.files.should.be.empty;
+ done();
+ });
+ });
});
describe("#compileAll", function() {

0 comments on commit 5c0bd15

Please sign in to comment.