Sha256: 468f12bfc6db3163be1ca4e133c5fd2737868d6ad0453dd09cf3b488e96d5d34

Contents?: true

Size: 614 Bytes

Versions: 4

Compression:

Stored size: 614 Bytes

Contents

require 'sprockets'
require 'tilt'

module Massimo
  class Javascript < Massimo::Resource
    def extension
      if Tilt.registered?(super[1..-1])
        '.js'
      else
        super
      end
    end
    
    def render
      if source_path.extname == '.js'
        options = Massimo.config.options_for(:sprockets).merge(
          :assert_root  => Massimo.config.output_path,
          :source_files => [ source_path.to_s ]
        )
        secretary = Sprockets::Secretary.new(options)
        secretary.install_assets
        @content = secretary.concatenation.to_s
      end
      super
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
massimo-0.10.3 lib/massimo/javascript.rb
massimo-0.10.2 lib/massimo/javascript.rb
massimo-0.10.1 lib/massimo/javascript.rb
massimo-0.10.0 lib/massimo/javascript.rb