Permalink
Browse files

allow CJS as a ext

  • Loading branch information...
1 parent 453cc37 commit a08dfff907e99d3c81648408e4b078950ecd7ee0 @alex-stripe alex-stripe committed Aug 17, 2012
View
@@ -58,7 +58,7 @@
return this.require;
}).call(this);
-this.require.define({"modules/program":function(exports, require, module){module.exports = function(){
+this.require.define({"modules/program.cjs":function(exports, require, module){module.exports = function(){
alert('Long live the Programs!');
};
;}});
@@ -4,11 +4,13 @@
module Sprockets
class CommonJS < Tilt::Template
- DEFINE_WRAPPER = '%s.define({%s:' +
+ WRAPPER = '%s.define({%s:' +
'function(exports, require, module){' +
'%s' +
";}});\n"
+ EXTENSIONS = %w{.module .cjs}
+
class << self
attr_accessor :default_namespace
end
@@ -36,7 +38,7 @@ def evaluate(scope, locals, &block)
attr_reader :namespace
def commonjs_module?(scope)
- File.extname(scope.logical_path) == '.module'
+ EXTENSIONS.include?(File.extname(scope.logical_path))
end
def module_name(scope)

0 comments on commit a08dfff

Please sign in to comment.