Sha256: fbf1219a6a5b69bd7f7bfcec4312139c9e57a5535eda4590e12c3ab2208fcaf0

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(node)
        node.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.14 lib/mascot/extensions/partials_remover.rb