Sha256: 018976ab5644c616b6a0f9c79ade624cad78e6b68020805d128392241cf99764

Contents?: true

Size: 500 Bytes

Versions: 1

Compression:

Stored size: 500 Bytes

Contents

module Mascot
  module Extensions
    # Removes files beginning with "_" from the resource collection.
    class PartialsRemover
      # Partial rails prefix.
      PARTIAL_PREFIX = "_".freeze

      def process_resources(resources)
        resources.each do |r|
          r.node.remove if self.class.partial? r.asset.path # Looks like a smiley face, doesn't it?
        end
      end

      def self.partial?(path)
        File.basename(path).starts_with? PARTIAL_PREFIX
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mascot-rails-0.1.12 lib/mascot/extensions/partials_remover.rb