Class: Zine::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/zine/style.rb

Overview

Render sass into CSS in the source directory, to be copied later

Instance Method Summary collapse

Constructor Details

#initialize(directories) ⇒ Style

Source & destination files



9
10
11
12
# File 'lib/zine/style.rb', line 9

def initialize(directories)
  @style_file = File.join directories['styles'], 'screen.scss'
  @css_file = File.join directories['source'], 'screen.css'
end

Instance Method Details

#process(string_or_file_writer) ⇒ Object

Write the CSS file



15
16
17
18
19
# File 'lib/zine/style.rb', line 15

def process(string_or_file_writer)
  sass = File.read(@style_file)
  css = SassC::Engine.new(sass, style: :compressed).render
  string_or_file_writer.write @css_file, css
end