Question

I'm trying to get the premailer gem working by following these instructions

I've setup my project by adding a gemfile to my folder and a rake file to run premailer.

My rake file looks like this -

task :default do
require 'premailer'

premailer = Premailer.new('email_source.html', :warn_level => Premailer::Warnings::SAFE)

# Write the HTML output
fout = File.open("output.html", "w")
fout.puts premailer.to_inline_css
fout.close

# Write the plain-text output
fout = File.open("ouput.txt", "w")
fout.puts premailer.to_plain_text
fout.close

# Output any CSS warnings
premailer.warnings.each do |w|
  puts "#{w[:message]} (#{w[:level]}) may not render properly in #{w[:clients]}"
end
end 

I'm getting the following error -

undefined method `create_border_shorthand!' for #<CssParser::RuleSet:0x00000101533278>

I've found this bug closed report on github but I'm not sure if that's the route of my problem.

Any idea what's going wrong?

Was it helpful?

Solution

Are you using Bundler (ie. do you have a Gemfile)?

If so, try adding this: gem 'css_parser', '1.2.5'

Then bundle install and try again. That will rule out the problem on the github issue report.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top