Sha256: 7c9e88e0b5c0f0adadd6cb07b633b3aacfb28058b5a8febbc9fb9dfcdb7baad9

Contents?: true

Size: 754 Bytes

Versions: 5

Compression:

Stored size: 754 Bytes

Contents

# encoding: utf-8
require 'htmlcompressor'
require 'easy_html_generator/generator/base'

# this generator minifies html files from src folder and copies them
# to the dist folder
class EasyHtmlGenerator::Generator::Minimize::Html <
  EasyHtmlGenerator::Generator::Base

  def initialize(project, config)
    super(project, config)

    @config.src  = project.config.paths.src.views
    @config.dest = project.config.paths.dist.views
  end

  def do_input(input, *_args)
    self.class.compress input
  end

  def input_to_output_file(i)
    super(i).gsub('.html', "#{@config.prefix_extension}.html")
  end

  def self.compressor
    @compressor ||= HtmlCompressor::Compressor.new
  end

  def self.compress(input)
    compressor.compress input
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
easy_html_generator-1.0.4 lib/easy_html_generator/generator/minimize/html.rb
easy_html_generator-1.0.3 lib/easy_html_generator/generator/minimize/html.rb
easy_html_generator-1.0.2 lib/easy_html_generator/generator/minimize/html.rb
easy_html_generator-1.0.1 lib/easy_html_generator/generator/minimize/html.rb
easy_html_generator-1.0.0 lib/easy_html_generator/generator/minimize/html.rb