module Content

Customers module to configure jekyll's bundle per website

Public Instance Methods

append(file, data) click to toggle source
# File lib/jekyll_theme_marketing/content.rb, line 7
def append(file, data)
  File.open(file, 'a') do |f|
    f.write data
  end
end
prepend(file, data) click to toggle source
# File lib/jekyll_theme_marketing/content.rb, line 13
def prepend(file, data)
  new_content = ''

  File.open(file, 'r') do |f|
    old_content = f.read
    new_content = +data << old_content
  end

  File.open(file, 'w') { |f| f.write new_content }
end
replace(file, old, new) click to toggle source
# File lib/jekyll_theme_marketing/content.rb, line 24
def replace(file, old, new)
  content = File.read(file)
  new_content = content.gsub(old, new)

  File.open(file, 'w') { |f| f.puts new_content }
end