Permalink
Browse files

Build CommonJS just like any other target, using "pre" and "post" wra…

…ppers
  • Loading branch information...
1 parent 6e4bd7f commit 43587531c881f7baa7a5c7314ebed15111459f76 @jhs jhs committed May 9, 2010
Showing with 17 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +3 −2 Rakefile
  3. +7 −0 mustache-commonjs/commonjs.mustache.js.tpl.post
  4. +6 −0 mustache-commonjs/commonjs.mustache.js.tpl.pre
View
@@ -2,3 +2,4 @@ runner.js
jquery.mustache.js
dojox
yui3
+commonjs.mustache.js
View
@@ -14,8 +14,9 @@ task :spec
desc "Package for CommonJS"
task :commonjs do
puts "Packaging for CommonJS"
- `mkdir lib`
- `cp mustache.js lib/mustache.js`
+ source = "mustache-commonjs"
+ target_jq = "commonjs.mustache.js"
+ `cat #{source}/#{target_jq}.tpl.pre mustache.js #{source}/#{target_jq}.tpl.post > #{target_jq}`
puts "Done."
end
@@ -0,0 +1,7 @@
+
+exports.name = Mustache.name;
+exports.version = Mustache.version;
+
+exports.to_html = function() {
+ return Mustache.to_html.apply(this, arguments);
+};
@@ -0,0 +1,6 @@
+/*
+ * CommonJS-compatible mustache.js module
+ *
+ * See http://github.com/janl/mustache.js for more info.
+ */
+

0 comments on commit 4358753

Please sign in to comment.