Class: Hassle::Compiler
- Inherits:
-
Object
- Object
- Hassle::Compiler
- Defined in:
- lib/hassle.rb
Instance Method Summary collapse
- #compile ⇒ Object
- #compile_location(*subdirs) ⇒ Object
- #css_location(path) ⇒ Object
- #normalize ⇒ Object
- #options ⇒ Object
- #prepare ⇒ Object
- #stylesheets ⇒ Object
Instance Method Details
#compile ⇒ Object
63 64 65 66 67 |
# File 'lib/hassle.rb', line 63 def compile normalize prepare Sass::Plugin.update_stylesheets end |
#compile_location(*subdirs) ⇒ Object
31 32 33 |
# File 'lib/hassle.rb', line 31 def compile_location(*subdirs) File.join(Dir.pwd, "tmp", "hassle", subdirs) end |
#css_location(path) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/hassle.rb', line 24 def css_location(path) = File.(path) public_dir = File.join(File.(Dir.pwd), "public") File.(compile_location(.gsub(public_dir, ''), '..')) end |
#normalize ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hassle.rb', line 35 def normalize template_location = [:template_location] if template_location.is_a?(Hash) || template_location.is_a?(Array) [:template_location] = template_location.to_a.map do |input, output| [input, css_location(input)] end else default_location = File.join([:css_location], "sass") [:template_location] = {default_location => css_location(default_location)} end end |
#options ⇒ Object
20 21 22 |
# File 'lib/hassle.rb', line 20 def Sass::Plugin. end |
#prepare ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/hassle.rb', line 48 def prepare .merge!(:cache => false, :never_update => false) [:template_location].to_a.each do |location| FileUtils.mkdir_p(location.last) end end |
#stylesheets ⇒ Object
57 58 59 60 61 |
# File 'lib/hassle.rb', line 57 def stylesheets [:template_location].to_a.map do |location| Dir[File.join(location.last, "**", "*.css")].map { |css| css.gsub(compile_location, "/") } end.flatten.sort end |