Sha256: 5d336358548832f8d2d948f37ca082f92ee1bd167d9b5fa233dde286329cfef2

Contents?: true

Size: 659 Bytes

Versions: 6

Compression:

Stored size: 659 Bytes

Contents

module Gumdrop::Support

  module Sprockets # mixes in to generator
    
    def sprockets(source_file, opts={})
      require 'sprockets'
      source_path = source_file || opt[:main] || opt[:from]
      env = ::Sprockets::Environment.new site.root
      env.append_path site.source_path
      env.append_path File.dirname(source_path)
      [opts[:paths]].flatten.each do |path|
        env.append_path(path) unless path.nil?
      end
      content= env[ source_path ].to_s
    rescue LoadError
      raise StandardError, "Sprockets can't be loaded. Please add it to your Gemfile."
    end

  end

  Gumdrop::Generator::DSL.send :include, Sprockets

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gumdrop-1.1.1 lib/gumdrop/support/sprockets.rb
gumdrop-1.1.0 lib/gumdrop/support/sprockets.rb
gumdrop-1.0.3 lib/gumdrop/support/sprockets.rb
gumdrop-1.0.2 lib/gumdrop/support/sprockets.rb
gumdrop-1.0.1 lib/gumdrop/support/sprockets.rb
gumdrop-1.0.0 lib/gumdrop/support/sprockets.rb