Sha256: 83bf1650926c8ba490993e04513e44e732446e7b6cbfcf1a51f493b39c919f98

Contents?: true

Size: 755 Bytes

Versions: 2

Compression:

Stored size: 755 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 File.expand_path(File.join site.source_path, File.dirname(source_path))
      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

2 entries across 2 versions & 1 rubygems

Version Path
gumdrop-1.1.3 lib/gumdrop/support/sprockets.rb
gumdrop-1.1.2 lib/gumdrop/support/sprockets.rb