https://github.com/jellyvision/getinline
Inlines CSS styles for HTML email development and preserves ERB tags
https://github.com/jellyvision/getinline
Last synced: about 1 month ago
JSON representation
Inlines CSS styles for HTML email development and preserves ERB tags
- Host: GitHub
- URL: https://github.com/jellyvision/getinline
- Owner: Jellyvision
- License: mit
- Created: 2015-12-11T19:49:29.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-29T21:57:18.000Z (over 9 years ago)
- Last Synced: 2025-04-26T08:42:16.956Z (about 2 months ago)
- Language: Ruby
- Size: 35.2 KB
- Stars: 8
- Watchers: 22
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this 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](https://rubygems.org/gems/getinline):
$ 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:
```shell
getinline ./public/index.erb --mode txt
getinline < ./public/index.erb
cat ./public/index.erb | getinline
```#### Rake Task
```ruby
require 'getinline'namespace :generate do
desc 'Generate inlined and plain text email templates'
task emails: :environment dofile = File.read('./public/index.erb')
html_transformer = Getinline::Transformer.new(file)
html_template = html_transformer.transformtext_transformer = Getinline::Transformer.new(file, mode: :txt)
text_template = text_transformer.transformFile.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](https://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](http://opensource.org/licenses/MIT).