Class: Pieces::StyleCompiler
- Inherits:
-
Object
- Object
- Pieces::StyleCompiler
- Defined in:
- lib/pieces/compilers/style_compiler.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #compile(files) ⇒ Object
-
#initialize(config = {}) ⇒ StyleCompiler
constructor
A new instance of StyleCompiler.
Constructor Details
#initialize(config = {}) ⇒ StyleCompiler
Returns a new instance of StyleCompiler.
5 6 7 |
# File 'lib/pieces/compilers/style_compiler.rb', line 5 def initialize(config = {}) @path = config[:path] || Dir.pwd end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/pieces/compilers/style_compiler.rb', line 3 def path @path end |
Instance Method Details
#compile(files) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/pieces/compilers/style_compiler.rb', line 9 def compile(files) files.merge('compiled.css' => { contents: '', type: 'css' }).tap do |files| Dir["#{path}/app/views/*/*.{css,scss,sass,less}"].each do |file| files['compiled.css'][:contents] << ::Tilt.new(file).render end end end |