Sha256: e089f37a798e3136618eb3d55cf89b79efd479718cad221341f7c07ee1728789

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

require 'fileutils'
require 'sass'

#just require bootsrap and it will be in the sass path
require 'bootstrap-sass'

::Sass.load_paths << './dev_root/shared/sass'

module Generator
  class SassGenerator
    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

    def compile file
      engine = Sass::Engine.new(File.read(file))
      engine.render
    end

    def write file, content
      File.open(file, "w") do |f|
        f.write content
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
easy_html_creator-1.2.0 lib/generator/sass_generator.rb