Class: EasyHtmlGenerator::Generator::Compile::Sass
- Inherits:
-
Base
- Object
- 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
#dest_path, #do_file, #generate, #log, #log_running, #resolve_path_prefix, #src_path, #walk_files
Constructor Details
#initialize(project, config) ⇒ Sass
Returns a new instance of Sass.
18
19
20
21
22
23
24
25
|
# 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}"
@config.src = project.config.paths.src.styles
@config.dest = project.config.paths.dist.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
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 27
def do_input(input, src='inline')
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 #{src} ", e.backtrace
end
|
44
45
46
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 44
def input_to_output_file(i)
super(i).gsub('.css.sass', '.css')
end
|
#should_do_file?(i) ⇒ Boolean
39
40
41
42
|
# File 'lib/easy_html_generator/generator/compile/sass.rb', line 39
def should_do_file?(i)
!File.basename(i).start_with? '_'
end
|