Class: Jekyll::Autoprefixer::Autoprefixer
- Inherits:
-
Object
- Object
- Jekyll::Autoprefixer::Autoprefixer
- Defined in:
- lib/jekyll/autoprefixer/autoprefixer.rb
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
-
#site ⇒ Object
readonly
Returns the value of attribute site.
Instance Method Summary collapse
-
#initialize(site) ⇒ Autoprefixer
constructor
A new instance of Autoprefixer.
- #process ⇒ Object
Constructor Details
#initialize(site) ⇒ Autoprefixer
Returns a new instance of Autoprefixer.
11 12 13 14 |
# File 'lib/jekyll/autoprefixer/autoprefixer.rb', line 11 def initialize(site) @site = site @batch = Array.new end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
9 10 11 |
# File 'lib/jekyll/autoprefixer/autoprefixer.rb', line 9 def batch @batch end |
#site ⇒ Object (readonly)
Returns the value of attribute site.
9 10 11 |
# File 'lib/jekyll/autoprefixer/autoprefixer.rb', line 9 def site @site end |
Instance Method Details
#process ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jekyll/autoprefixer/autoprefixer.rb', line 16 def process() = @site.config['autoprefixer'] || {} if !['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, )) end end end @batch.clear end |