Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

pass the filename option to coffeescript compile, fixes #8 #9

Merged
merged 1 commit into from

2 participants

@RonnyPfannschmidt

the change looks fine to me,
but i don't yet have an idea on how to test

@nrw nrw merged commit e5e310d into nrw:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2012
  1. pass the filename option to coffeescript compile, fixes #8

    Ronny Pfannschmidt authored
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 11 deletions.
  1. +7 −7 build/compile.js
  2. +3 −3 build/remove.js
  3. +1 −1  src/compile.coffee
View
14 build/compile.js
@@ -1,4 +1,5 @@
(function() {
+
module.exports = {
before: "modules",
run: function(root, path, settings, doc, callback) {
@@ -9,12 +10,8 @@
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");
@@ -25,7 +22,9 @@
var js, name, rel;
rel = utils.relpath(filename, path);
console.log("Compiling attachment " + rel);
- js = coffee.compile(fs.readFileSync(filename, 'utf8'));
+ js = coffee.compile(fs.readFileSync(filename, 'utf8'), {
+ filename: filename
+ });
name = rel.replace(extension_pattern, ".js");
precompiler.addAttachment(doc, name, filename, js);
return callback(null, doc);
@@ -50,4 +49,5 @@
});
}
};
+
}).call(this);
View
6 build/remove.js
@@ -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
2  src/compile.coffee
@@ -28,7 +28,7 @@ module.exports =
rel = utils.relpath(filename, path)
console.log("Compiling attachment #{rel}")
- js = coffee.compile(fs.readFileSync filename, 'utf8')
+ js = coffee.compile(fs.readFileSync(filename, 'utf8'), filename: filename)
name = rel.replace(extension_pattern, ".js")
precompiler.addAttachment(doc, name, filename,js)
callback(null, doc)
Something went wrong with that request. Please try again.