Skip to content

Commit

Permalink
extract CommonJS#common_js_module?
Browse files Browse the repository at this point in the history
Conflicts:

	lib/sprockets/commonjs.rb
  • Loading branch information
James A. Rosen committed Jul 24, 2012
1 parent bbc68b5 commit 79ba43d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/sprockets/commonjs.rb
Expand Up @@ -21,7 +21,7 @@ def prepare
end

def evaluate(scope, locals, &block)
if File.extname(scope.logical_path) == '.module'
if commonjs_module?(scope)
path = scope.logical_path
path = path.gsub(/^\.?\//, '') # Remove relative paths
path = path.chomp('.module') # Remove module ext
Expand All @@ -38,6 +38,10 @@ def evaluate(scope, locals, &block)

attr_reader :namespace

def commonjs_module?(scope)
File.extname(scope.logical_path) == '.module'
end

end

register_postprocessor 'application/javascript', CommonJS
Expand Down

0 comments on commit 79ba43d

Please sign in to comment.