Class: Distil::CssProduct

Inherits:
Product
  • Object
show all
Defined in:
lib/distil/product/css-product.rb

Instance Attribute Summary

Attributes inherited from Product

#assets, #files, #language, #libraries, #project, #variant

Instance Method Summary collapse

Methods inherited from Product

#build, #clean, #filename, #gzip, #gzip_filename, #handles_file?, #include_file, #initialize, #minimise, #minimised_filename, #notice_comment, #output_path, #up_to_date?

Constructor Details

This class inherits a constructor from Distil::Product

Instance Method Details

#build_debugObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/distil/product/css-product.rb', line 7

def build_debug
  File.open(output_path, "w") { |output|

    output.puts notice_comment
    output_files= []
    
    libraries.each { |l|
      f= project.file_from_path(l.file_for(content_type, language, variant))
      output_files << f if f
    }

    output_files += files
    
    output_files.each { |f|
      output.puts "@import url(\"#{f.relative_path}\");"
    }
    
  }
end

#build_releaseObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/distil/product/css-product.rb', line 27

def build_release
  File.open(output_path, "w") { |output|

    output.puts notice_comment

    output_files= []
    
    libraries.each { |l|
      f= project.file_from_path(l.file_for(content_type, language, variant))
      output_files << f if f
    }

    output_files += files
    
    output_files.each { |f|
      content= f.rewrite_content_relative_to_path(nil)
      next if !content || content.empty?

      output.puts "/* #{f.relative_path} */"
      output.puts content
      output.puts ""
    }
    
  }
end