Sha256: 842e7529dd04e097ec4adc0e3ff01968c3b26153dde1a404711e739e3c62a31a
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 require 'sass' require 'easy_html_generator' require 'easy_html_generator/generator/compile/base' # this generator compiles sass files from src folder and copies them # to the dist folder class EasyHtmlGenerator::Generator::Compile::Sass < EasyHtmlGenerator::Generator::Compile::Base def self.add_load_path(path) ::Sass.load_paths << path unless ::Sass.load_paths.include?(path) end add_load_path EasyHtmlGenerator::SHARED_STYLES_PATH def initialize(project, config) super(project, config) self.class.add_load_path "#{@project.src_path_to :styles}" end def do_input!(input, input_file = 'inline', *_args) renderer = ::Sass::Engine.new(input) result = renderer.render return result unless @config.minimize EasyHtmlGenerator::Generator::Minimize::Css.compress result rescue StandardError => e raise e, "#{e.message} in #{input_file} ", e.backtrace end def file_changed?(file) # regenerate all sass files except imported once !File.basename(file).start_with? '_' end def input_to_output_file(input_file, config) super(input_file, config).gsub('.css.sass', '.css') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
easy_html_generator-1.0.6 | lib/easy_html_generator/generator/compile/sass.rb |
easy_html_generator-1.0.5 | lib/easy_html_generator/generator/compile/sass.rb |