Permalink
Browse files

add filename with relative path to syntax errors for modules and atta…

…chments. version bump.
  • Loading branch information...
1 parent e5e310d commit fd880a6cf032371a43dac6cc9282f0e9e6952f19 @nrw committed Mar 17, 2012
Showing with 16 additions and 12 deletions.
  1. +10 −6 build/compile.js
  2. +3 −3 build/remove.js
  3. +1 −1 kanso.json
  4. +2 −2 src/compile.coffee
View
@@ -1,5 +1,4 @@
(function() {
-
module.exports = {
before: "modules",
run: function(root, path, settings, doc, callback) {
@@ -10,8 +9,12 @@
console.log("Coffee script precompiler must have either a modules or an attachment setting");
return callback(null, doc);
}
- if (modulesPaths == null) modulesPaths = [];
- if (attachmentsPaths == null) attachmentsPaths = [];
+ if (modulesPaths == null) {
+ modulesPaths = [];
+ }
+ if (attachmentsPaths == null) {
+ attachmentsPaths = [];
+ }
async = require("async");
utils = require("kanso-utils/utils");
precompiler = require("kanso-precompiler-base");
@@ -23,7 +26,7 @@
rel = utils.relpath(filename, path);
console.log("Compiling attachment " + rel);
js = coffee.compile(fs.readFileSync(filename, 'utf8'), {
- filename: filename
+ filename: rel
});
name = rel.replace(extension_pattern, ".js");
precompiler.addAttachment(doc, name, filename, js);
@@ -33,7 +36,9 @@
var js, name, rel;
rel = utils.relpath(filename, path);
console.log("Compiling module " + rel);
- js = coffee.compile(fs.readFileSync(filename, 'utf8'));
+ js = coffee.compile(fs.readFileSync(filename, 'utf8'), {
+ filename: rel
+ });
name = rel.replace(extension_pattern, "");
precompiler.addModule(doc, name, filename, js);
return callback(null, doc);
@@ -49,5 +54,4 @@
});
}
};
-
}).call(this);
View
@@ -1,14 +1,14 @@
(function() {
-
module.exports = {
after: "attachments",
run: function(root, path, settings, doc, callback) {
var k;
for (k in doc._attachments || {}) {
- if (/\.coffee$/.test(k)) delete doc._attachments[k];
+ if (/\.coffee$/.test(k)) {
+ delete doc._attachments[k];
+ }
}
return callback(null, doc);
}
};
-
}).call(this);
View
@@ -1,6 +1,6 @@
{
"name": "coffee-script-precompiler",
- "version": "1.2.0-kanso.1",
+ "version": "1.2.0-kanso.2",
"categories": ["build-tools"],
"description": "Compiles CoffeeScript modules and attachments to javascript on each push",
"url": "https://github.com/nrw/coffee-script-precompiler/",
View
@@ -28,7 +28,7 @@ module.exports =
rel = utils.relpath(filename, path)
console.log("Compiling attachment #{rel}")
- js = coffee.compile(fs.readFileSync(filename, 'utf8'), filename: filename)
+ js = coffee.compile fs.readFileSync(filename, 'utf8'), filename: rel
name = rel.replace(extension_pattern, ".js")
precompiler.addAttachment(doc, name, filename,js)
callback(null, doc)
@@ -38,7 +38,7 @@ module.exports =
rel = utils.relpath(filename, path)
console.log("Compiling module #{rel}")
- js = coffee.compile(fs.readFileSync filename, 'utf8')
+ js = coffee.compile fs.readFileSync(filename, 'utf8'), filename: rel
name = rel.replace(extension_pattern, "")
precompiler.addModule(doc, name, filename, js)
callback(null, doc)

0 comments on commit fd880a6

Please sign in to comment.