class Jekyll::Autoprefixer::Autoprefixer

Attributes

batch[R]
site[R]

Public Class Methods

new(site) click to toggle source
# File lib/jekyll/autoprefixer/autoprefixer.rb, line 11
def initialize(site)
  @site = site
  @batch = Array.new
end

Public Instance Methods

process() click to toggle source
# File lib/jekyll/autoprefixer/autoprefixer.rb, line 16
def process()
  options = @site.config['autoprefixer'] || {}

  if !options['only_production'] || Jekyll.env == "production"
    @batch.each do |item|
      path = item.destination(@site.dest)

      File.open(path, 'r+') do |file|
        content = file.read
        file.truncate(0)
        file.rewind
        file.write(AutoprefixerRails.process(content, options))
      end
    end
  end

  @batch.clear
end