Sha256: c9cd72088dea137830c8eb94bfa66745a89aa8e286c74471ba231b0999d29ee5

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 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(node)
        node.flatten.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

2 entries across 2 versions & 1 rubygems

Version Path
mascot-rails-0.1.16 lib/mascot/extensions/partials_remover.rb
mascot-rails-0.1.15 lib/mascot/extensions/partials_remover.rb