Skip to content

Commit

Permalink
Remove dependency on monocle
Browse files Browse the repository at this point in the history
This is primarily to fix installation of jade on node@0.8
  • Loading branch information
ForbesLindesay committed Dec 16, 2014
1 parent 44fee98 commit 0266982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
24 changes: 14 additions & 10 deletions bin/jade.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ var fs = require('fs')
, resolve = path.resolve
, exists = fs.existsSync || path.existsSync
, join = path.join
, monocle = require('monocle')()
, mkdirp = require('mkdirp')
, jade = require('../');

Expand Down Expand Up @@ -106,16 +105,21 @@ var files = program.args;
if (files.length) {
console.log();
if (options.watch) {
// keep watching when error occured.
process.on('uncaughtException', function(err) {
console.error(err);
});
files.forEach(renderFile);
monocle.watchFiles({
files: files,
listener: function(file) {
renderFile(file.absolutePath);
files.forEach(function(filename) {
try {
renderFile(filename);
} catch (ex) {
// keep watching when error occured.
console.error(ex.stack || ex.message || ex);
}
fs.watchFile(filename, {persistent: true, interval: 200}, function (filename) {
try {
renderFile(filename);

This comment has been minimized.

Copy link
@realyze

realyze Dec 20, 2014

@ForbesLindesay This change breaks watch. You're shadowing filename with fs.Stats (argument).

} catch (ex) {
// keep watching when error occured.
console.error(ex.stack || ex.message || ex);
}
});
});
} else {
files.forEach(renderFile);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"commander": "~2.5.0",
"constantinople": "~3.0.1",
"mkdirp": "~0.5.0",
"monocle": "1.1.51",
"transformers": "2.1.0",
"void-elements": "~1.0.0",
"with": "~4.0.0"
Expand Down

0 comments on commit 0266982

Please sign in to comment.