Class: Montage::SassBuilder
- Inherits:
-
Object
- Object
- Montage::SassBuilder
- Defined in:
- lib/montage/sass_builder.rb
Overview
Given a project, builds a SASS file containing mixin to simplify use of the generated sprites in a project.
Constant Summary collapse
- TEMPLATE =
Pathname.new(__FILE__).dirname + 'templates/sass_mixins.erb'
Instance Method Summary collapse
-
#initialize(project) ⇒ SassBuilder
constructor
Creates a new SassBuilder instance.
-
#write ⇒ Boolean
Builds the Sass mixin file, then writes it to disk.
Constructor Details
#initialize(project) ⇒ SassBuilder
Creates a new SassBuilder instance.
14 15 16 |
# File 'lib/montage/sass_builder.rb', line 14 def initialize(project) @project = project end |
Instance Method Details
#write ⇒ Boolean
Builds the Sass mixin file, then writes it to disk.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/montage/sass_builder.rb', line 22 def write if @project.paths.sass.to_s[-5..-1] == '.sass' @project.paths.sass.dirname.mkpath save_to = @project.paths.sass else @project.paths.sass.mkpath save_to = @project.paths.sass + '_montage.sass' end File.open(save_to, 'w') do |file| file.puts ERB.new(File.read(TEMPLATE), nil, '<>').result(binding) end end |