Sha256: e95328cd176a9dd00cbf9d138ebcef027a307ebc85ac36d67546dafe5477cc87

Contents?: true

Size: 850 Bytes

Versions: 1

Compression:

Stored size: 850 Bytes

Contents

require 'sprockets'

module Puffer
  module Extensions
    module DirectiveProcessor
      extend ActiveSupport::Concern

      def process_require_all_directive(path)
        raise ArgumentError, "require_all argument must be relative" unless relative?(path)

        context.environment.paths.each do |root_path|
          root = Pathname.new(root_path).join(path).expand_path

          if root.exist? && root.directory?
            context.depend_on(root)

            Dir["#{root}/*"].sort.each do |filename|
              if filename == self.file
                next
              elsif context.asset_requirable?(filename)
                context.require_asset(filename)
              end
            end
          end
        end
      end
    end
  end
end

Sprockets::DirectiveProcessor.send :include, Puffer::Extensions::DirectiveProcessor

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puffer-0.1.1 lib/puffer/extensions/directive_processor.rb