lib/massimo/javascript.rb in massimo-0.8.5 vs lib/massimo/javascript.rb in massimo-0.9.0
- old
+ new
@@ -1,9 +1,17 @@
require 'sprockets'
module Massimo
class Javascript < Massimo::Resource
+ def extension
+ if Tilt.registered?(super[1..-1])
+ '.js'
+ else
+ super
+ end
+ end
+
def render
output = if source_path.extname == '.js'
options = Massimo.config.options_for(:sprockets).merge(
:assert_root => Massimo.config.output_path,
:source_files => [ source_path.to_s ]
@@ -13,13 +21,9 @@
secretary.concatenation.to_s
else
super
end
compress(output)
- end
-
- def extension
- @extension ||= '.js'
end
protected
def compress(javascript)
\ No newline at end of file