Class: EasyHtmlGenerator::Generator::Compile::Sass
- Inherits:
-
Base
- Object
- Base
- Base
- EasyHtmlGenerator::Generator::Compile::Sass
show all
- Defined in:
- lib/easy_html_generator/generator/compile/sass.rb
Overview
this generator compiles sass files from src folder and copies them to the dist folder
Instance Attribute Summary
Attributes inherited from Base
#config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#do_file, #generate!, #walk_files, #watch_files
Methods inherited from Base
#enabled?, #generate, #generate!, #log, #log_running, #repetitive?, #store_file_hash, #tasks
Constructor Details
#initialize(project, config) ⇒ Sass
18
19
20
21
22
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 18
def initialize(project, config)
super(project, config)
self.class.add_load_path "#{@project.src_path_to :styles}"
end
|
Class Method Details
.add_load_path(path) ⇒ Object
12
13
14
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 12
def self.add_load_path(path)
::Sass.load_paths << path unless ::Sass.load_paths.include?(path)
end
|
Instance Method Details
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 24
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
|
#file_changed?(file) ⇒ Boolean
35
36
37
38
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 35
def file_changed?(file)
!File.basename(file).start_with? '_'
end
|
40
41
42
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 40
def input_to_output_file(input_file, config)
super(input_file, config).gsub('.css.sass', '.css')
end
|