Class: Coyote::Bundles::CSS

Inherits:
Base
  • Object
show all
Defined in:
lib/coyote/bundles/css.rb

Instance Attribute Summary

Attributes inherited from Base

#assets, #target

Instance Method Summary collapse

Methods inherited from Base

#add, #add_dependencies, #add_directory, #add_file, #empty!, #files, filetypes, #initialize, #manifest, #path_is_directory_or_kosher_file?, #rebuild!, #reset!, #save!, #update!

Constructor Details

This class inherits a constructor from Coyote::Bundles::Base

Instance Method Details

#compress!Object



5
6
7
8
9
10
11
# File 'lib/coyote/bundles/css.rb', line 5

def compress!
  notify "Compressing bundle...", :warning, :timestamp
  tmp = "#{@target}.#{Time.now.to_i}.less"
  File.open(tmp, 'w+') { |f| f.write contents }
  self.contents = `lessc #{tmp} -x`
  File.delete tmp
end

#contentsObject



13
14
15
# File 'lib/coyote/bundles/css.rb', line 13

def contents
  @contents ||= @assets[files.first].compile!.contents
end