Project

getinline

0.0
No commit activity in last 3 years
No release in over 3 years
Inlines CSS styles for HTML email development and preserves ERB tags
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 0.10.3
~> 10.0
>= 0

Runtime

~> 1.6.6.4
~> 1.8.6
 Project Readme

Getinline

A CSS inliner for Ruby ERB templates.

The motivation for this project is automating the premailer inliner and plain text generator such that ERB template variables are respected.

Installation

Install the Getinline gem from RubyGems:

$ gem install getinline

or add it to your Gemfile and run bundle.

Examples

Command Line

getinline can be invoked in any of the following ways on the command line:

getinline ./public/index.erb --mode txt
getinline < ./public/index.erb
cat ./public/index.erb | getinline

Rake Task

require 'getinline'

namespace :generate do
  desc 'Generate inlined and plain text email templates'
  task emails: :environment do

    file = File.read('./public/index.erb')

    html_transformer = Getinline::Transformer.new(file)
    html_template = html_transformer.transform

    text_transformer = Getinline::Transformer.new(file, mode: :txt)
    text_template = text_transformer.transform

    File.write('./public/inline/index.erb', html_template)
    File.write('./public/text/index.erb', text_template)
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jellyvision/getinline.

License

The gem is available as open source under the terms of the MIT License.