Class: Compass::Compiler
- Inherits:
-
Object
- Object
- Compass::Compiler
- Includes:
- Actions
- Defined in:
- lib/compass/compiler.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#options ⇒ Object
Returns the value of attribute options.
-
#to ⇒ Object
Returns the value of attribute to.
-
#working_path ⇒ Object
Returns the value of attribute working_path.
Attributes included from Actions
Instance Method Summary collapse
- #css_files ⇒ Object
-
#initialize(working_path, from, to, options) ⇒ Compiler
constructor
A new instance of Compiler.
- #run ⇒ Object
- #sass_files ⇒ Object
- #stylesheet_name(sass_file) ⇒ Object
- #target_directories ⇒ Object
Methods included from Actions
#basename, #compile, #copy, #directory, #relativize, #separate, #strip_trailing_separator, #write_file
Constructor Details
#initialize(working_path, from, to, options) ⇒ Compiler
Returns a new instance of Compiler.
8 9 10 11 12 13 |
# File 'lib/compass/compiler.rb', line 8 def initialize(working_path, from, to, ) self.working_path = working_path self.from, self.to = from, to self.logger = .delete(:logger) self. = end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
6 7 8 |
# File 'lib/compass/compiler.rb', line 6 def from @from end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/compass/compiler.rb', line 6 def @options end |
#to ⇒ Object
Returns the value of attribute to.
6 7 8 |
# File 'lib/compass/compiler.rb', line 6 def to @to end |
#working_path ⇒ Object
Returns the value of attribute working_path.
6 7 8 |
# File 'lib/compass/compiler.rb', line 6 def working_path @working_path end |
Instance Method Details
#css_files ⇒ Object
23 24 25 |
# File 'lib/compass/compiler.rb', line 23 def css_files @css_files || sass_files.map{|sass_file| "#{to}/#{stylesheet_name(sass_file)}.css"} end |
#run ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/compass/compiler.rb', line 31 def run target_directories.each do |dir| directory dir end sass_files.zip(css_files).each do |sass_filename, css_filename| compile sass_filename, css_filename, end end |
#sass_files ⇒ Object
15 16 17 |
# File 'lib/compass/compiler.rb', line 15 def sass_files @sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass")) end |
#stylesheet_name(sass_file) ⇒ Object
19 20 21 |
# File 'lib/compass/compiler.rb', line 19 def stylesheet_name(sass_file) sass_file[("#{from}/".length)..-6] end |
#target_directories ⇒ Object
27 28 29 |
# File 'lib/compass/compiler.rb', line 27 def target_directories css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length } end |