Class: Generator::SassGenerator
- Inherits:
-
Object
- Object
- Generator::SassGenerator
- Defined in:
- lib/generator/sass_generator.rb
Instance Method Summary (collapse)
- - (Object) compile(file)
- - (Object) generate(input_folder, output_folder)
- - (Object) write(file, content)
Instance Method Details
- (Object) compile(file)
20 21 22 23 |
# File 'lib/generator/sass_generator.rb', line 20 def compile file engine = Sass::Engine.new(File.read(file)) engine.render end |
- (Object) generate(input_folder, output_folder)
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generator/sass_generator.rb', line 9 def generate input_folder, output_folder Dir.glob("#{input_folder}/*.sass").select do |file| file_name = file.split('/')[-1] next unless File.file? file and file_name[0] != '_' result = compile(file) file_name = file.split('/')[-1].gsub('.sass', '.css') write File.join(output_folder, file_name), result end end |
- (Object) write(file, content)
25 26 27 28 29 |
# File 'lib/generator/sass_generator.rb', line 25 def write file, content File.open(file, "w") do |f| f.write content end end |