Module: Octopress::AutoPrefixer

Defined in:
lib/octopress-autoprefixer.rb

Class Method Summary collapse

Class Method Details

.find_stylesheets(dir) ⇒ Object



12
13
14
15
# File 'lib/octopress-autoprefixer.rb', line 12

def self.find_stylesheets(dir)
  return [] unless Dir.exist? dir
  Find.find(dir).to_a.reject {|f| File.extname(f) != '.css' }
end

.prefix(stylesheet, options) ⇒ Object



23
24
25
26
27
28
# File 'lib/octopress-autoprefixer.rb', line 23

def self.prefix(stylesheet, options)
  content = File.open(stylesheet).read
  File.open(stylesheet, 'w') do |f|
    f.write(AutoprefixerRails.process(content, options))
  end
end

.process(site) ⇒ Object



17
18
19
20
21
# File 'lib/octopress-autoprefixer.rb', line 17

def self.process(site)
  find_stylesheets(site.config['destination']).each do |file|
    prefix(file, site.config['autoprefixer'] || {})
  end
end