premailer-rails-revived 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.github/workflows/build.yml +43 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +165 -0
- data/Gemfile +28 -0
- data/LICENSE +14 -0
- data/README.md +180 -0
- data/Rakefile +7 -0
- data/VERSION +1 -0
- data/example/.gitignore +16 -0
- data/example/Gemfile +10 -0
- data/example/README.md +10 -0
- data/example/Rakefile +6 -0
- data/example/app/assets/stylesheets/email.css +32 -0
- data/example/app/mailers/example_mailer.rb +7 -0
- data/example/app/views/example_mailer/test_message.html.erb +18 -0
- data/example/bin/rails +4 -0
- data/example/config/application.rb +12 -0
- data/example/config/boot.rb +3 -0
- data/example/config/environment.rb +5 -0
- data/example/config/environments/development.rb +9 -0
- data/example/config/environments/production.rb +9 -0
- data/example/config/initializers/assets.rb +2 -0
- data/example/config/routes.rb +3 -0
- data/example/config/secrets.yml +2 -0
- data/example/config.ru +4 -0
- data/example/test/mailers/previews/example_mailer_preview.rb +5 -0
- data/lib/premailer/rails/css_helper.rb +70 -0
- data/lib/premailer/rails/css_loaders/asset_pipeline_loader.rb +36 -0
- data/lib/premailer/rails/css_loaders/file_system_loader.rb +37 -0
- data/lib/premailer/rails/css_loaders/network_loader.rb +39 -0
- data/lib/premailer/rails/css_loaders/propshaft_loader.rb +33 -0
- data/lib/premailer/rails/css_loaders.rb +6 -0
- data/lib/premailer/rails/customized_premailer.rb +20 -0
- data/lib/premailer/rails/hook.rb +140 -0
- data/lib/premailer/rails/railtie.rb +9 -0
- data/lib/premailer/rails/version.rb +7 -0
- data/lib/premailer/rails.rb +31 -0
- data/premailer-rails.gemspec +32 -0
- data/spec/integration/css_helper_spec.rb +192 -0
- data/spec/integration/delivery_spec.rb +13 -0
- data/spec/integration/hook_spec.rb +163 -0
- data/spec/rails_app/app/assets/config/manifest.js +3 -0
- data/spec/rails_app/app/assets/stylesheets/application.css +3 -0
- data/spec/rails_app/app/mailers/application_mailer.rb +4 -0
- data/spec/rails_app/app/mailers/welcome_mailer.rb +6 -0
- data/spec/rails_app/app/views/layouts/mailer.html.erb +11 -0
- data/spec/rails_app/app/views/welcome_mailer/welcome_email.html.erb +1 -0
- data/spec/rails_app/config/application.rb +16 -0
- data/spec/rails_app/config/boot.rb +5 -0
- data/spec/rails_app/config/environment.rb +2 -0
- data/spec/rails_app/config/environments/test.rb +10 -0
- data/spec/rails_app/config/routes.rb +3 -0
- data/spec/rails_app/config.ru +5 -0
- data/spec/rails_app/log/.keep +0 -0
- data/spec/rails_app/tmp/.keep +0 -0
- data/spec/spec_helper.rb +23 -0
- data/spec/support/fixtures/html.rb +38 -0
- data/spec/support/fixtures/message.rb +182 -0
- data/spec/unit/css_loaders/asset_pipeline_loader_spec.rb +57 -0
- data/spec/unit/css_loaders/file_system_loader_spec.rb +37 -0
- data/spec/unit/css_loaders/network_loader_spec.rb +58 -0
- data/spec/unit/css_loaders/propshaft_loader_spec.rb +57 -0
- data/spec/unit/customized_premailer_spec.rb +64 -0
- data/spec/unit/premailer_rails_spec.rb +19 -0
- metadata +233 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6777fc2b0d9d7a3627d1799ad29bfedc65e95d4092440e2f0adfc91d7b77483b
|
4
|
+
data.tar.gz: 3af75c762f4aa235c5c84db8d5201a9a442ed324caceb0f9b76ac55ef0a62f70
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 802a9dde3b61a7008800008cfe889d3e6b2eddadcffe10ecbe7af6e337e39bc45cf1b3e4d4514c8ca2a362473caa669b22792a38113add1c97f9d51ba70c4e81
|
7
|
+
data.tar.gz: c14eb13a90a129225d0c62ba6e827c8f66b199e5642fb4b0018c274875fcfdef87ffefb98fe3b3f8ed0ef09f472aef2f0bd992de8751e47f8e80e732455b1b75
|
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
@@ -0,0 +1,43 @@
|
|
1
|
+
name: tests
|
2
|
+
on: push
|
3
|
+
jobs:
|
4
|
+
test:
|
5
|
+
runs-on: ubuntu-latest
|
6
|
+
strategy:
|
7
|
+
matrix:
|
8
|
+
ruby:
|
9
|
+
- '2.7.x'
|
10
|
+
- '3.0.x'
|
11
|
+
- '3.1.x'
|
12
|
+
active_support:
|
13
|
+
- '6.0.0'
|
14
|
+
- '6.1.0'
|
15
|
+
- '7.0.0'
|
16
|
+
assets_gem:
|
17
|
+
- 'sprockets-rails'
|
18
|
+
- 'propshaft'
|
19
|
+
exclude:
|
20
|
+
- active_support: '6.0.0'
|
21
|
+
assets_gem: 'propshaft'
|
22
|
+
- active_support: '6.1.0'
|
23
|
+
assets_gem: 'propshaft'
|
24
|
+
|
25
|
+
steps:
|
26
|
+
- name: Checkout
|
27
|
+
uses: actions/checkout@v1
|
28
|
+
- name: Setup Ruby
|
29
|
+
uses: actions/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
- name: Bundle
|
33
|
+
env:
|
34
|
+
ACTION_MAILER_VERSION: ${{ matrix.active_support }}
|
35
|
+
ASSETS_GEM: ${{ matrix.assets_gem }}
|
36
|
+
run: |
|
37
|
+
gem install bundler
|
38
|
+
bundle install --jobs 4 --retry 3
|
39
|
+
- name: Test
|
40
|
+
env:
|
41
|
+
ACTION_MAILER_VERSION: ${{ matrix.active_support }}
|
42
|
+
ASSETS_GEM: ${{ matrix.assets_gem }}
|
43
|
+
run: bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v1.12.0
|
4
|
+
- Fork and revive this gem
|
5
|
+
- Test on github actions rather than travis
|
6
|
+
- Add support for rails 7 and propshaft
|
7
|
+
|
8
|
+
## v1.11.1
|
9
|
+
|
10
|
+
- Check if `Rails.application` is defined (@pabloh, #250)
|
11
|
+
|
12
|
+
## v1.11.0
|
13
|
+
|
14
|
+
- Remove `force_encoding!`
|
15
|
+
|
16
|
+
## v1.10.3
|
17
|
+
|
18
|
+
- Remove upper version constraint for actionmailer
|
19
|
+
|
20
|
+
## v1.10.2
|
21
|
+
|
22
|
+
- Explicitly check for assets_manifest (@derekwheel, #214)
|
23
|
+
|
24
|
+
## v1.10.1
|
25
|
+
|
26
|
+
- Catch error when sprockets can't find asset (@kirs, #209)
|
27
|
+
|
28
|
+
## v1.10.0
|
29
|
+
|
30
|
+
- Drop support for hpricot now that premailer-rails also doesn't support it
|
31
|
+
- Use `Rails.application.assets_manifest` instead of `Rails.application.assets` in Asset Pipeline loader (@kirs, #201)
|
32
|
+
- Introduce `:strategies` config option that allows to control CSS fetching stragies
|
33
|
+
|
34
|
+
## v1.9.7
|
35
|
+
|
36
|
+
- Use `Rails.root` in `FileSystemLoader` (@stanhu, #195)
|
37
|
+
|
38
|
+
## v1.9.6
|
39
|
+
|
40
|
+
- Handle `relative_url_root` in when loading CSS from file system
|
41
|
+
|
42
|
+
## v1.9.5
|
43
|
+
|
44
|
+
- Mention license in gemspec
|
45
|
+
|
46
|
+
## v1.9.4
|
47
|
+
|
48
|
+
- Improve check for Rails module
|
49
|
+
- Preserve body encoding to prevent garbled mails
|
50
|
+
|
51
|
+
## v1.9.3
|
52
|
+
|
53
|
+
- Add support for rails' `relative_url_root` config
|
54
|
+
- Fix link tag removal under Hpricot
|
55
|
+
- Pass url to `asset_host` if it responds to `call`
|
56
|
+
- Fixed issue where urls may conflict with folder names.
|
57
|
+
|
58
|
+
## v1.9.2
|
59
|
+
|
60
|
+
- Update rails dependency to allow rails 5
|
61
|
+
|
62
|
+
## v1.9.1
|
63
|
+
|
64
|
+
- Respect data-premailer="ignore" on link tags
|
65
|
+
- Ensure content-transfer-encoding is maintained
|
66
|
+
|
67
|
+
## v1.9.0
|
68
|
+
|
69
|
+
- Improved CSS loading and caching.
|
70
|
+
- Fixed incompatibility with newer rails and sprockets versions.
|
71
|
+
|
72
|
+
## v1.8.2
|
73
|
+
|
74
|
+
- `Premailer::Rails::CSSLoaders::NetworkLoader` is more resilient and works even
|
75
|
+
if the Rails asset host is set without a URI scheme. (panthomakos)
|
76
|
+
- Remove stylesheet links from the HTML that have been processed.
|
77
|
+
|
78
|
+
## v1.8.1
|
79
|
+
|
80
|
+
- Add support for longer fingerprint generated by sprocket 3.
|
81
|
+
|
82
|
+
## v1.8.0
|
83
|
+
|
84
|
+
- `ActionMailer` interceptors are registered after Rails initialization and no
|
85
|
+
longer when loading this gem. If you were using this gem outside Rails, you'll
|
86
|
+
need to call `Premailer::Rails.register_interceptors` manually.
|
87
|
+
|
88
|
+
## v1.7.0
|
89
|
+
|
90
|
+
- Register preview hook for the new previewing functionality introduced in
|
91
|
+
rails 4.1.0
|
92
|
+
|
93
|
+
- Add example rails application
|
94
|
+
|
95
|
+
## v1.6.1
|
96
|
+
|
97
|
+
- Remove Nokogiri unicode fix since it's working properly without it by now
|
98
|
+
|
99
|
+
- Make sure html part comes before text part
|
100
|
+
|
101
|
+
## v1.6.0
|
102
|
+
|
103
|
+
- Only use asset pipeline if Rails is defined and if compile is true
|
104
|
+
|
105
|
+
- Depend on actionmailer instead of rails
|
106
|
+
|
107
|
+
- Check whether `::Rails` is defined before using it
|
108
|
+
|
109
|
+
- Add ability to skip premailer
|
110
|
+
|
111
|
+
- Test against multiple action mailer versions on travis
|
112
|
+
|
113
|
+
- Ensure CSS strings are always UTF-8 encoded
|
114
|
+
|
115
|
+
- Require premailer version >= 1.7.9
|
116
|
+
|
117
|
+
## v1.5.1
|
118
|
+
|
119
|
+
- Prefer precompiled assets over asset pipeline
|
120
|
+
|
121
|
+
- Improve construction of file URL when requesting from CDN
|
122
|
+
|
123
|
+
- No longer use open-uri
|
124
|
+
|
125
|
+
- Remove gzip unzipping after requesting file
|
126
|
+
|
127
|
+
## v1.5.0
|
128
|
+
|
129
|
+
- No longer support ruby 1.8
|
130
|
+
|
131
|
+
- Find linked stylesheets by `rel='stylesheet'` attribute instead of
|
132
|
+
`type='text/css'`
|
133
|
+
|
134
|
+
- Don't test hpricot on JRuby due to incompatibility
|
135
|
+
|
136
|
+
## v1.4.0
|
137
|
+
|
138
|
+
- Fix attachments
|
139
|
+
|
140
|
+
## v1.3.2
|
141
|
+
|
142
|
+
- Rename gem to premailer-rails (drop the 3)
|
143
|
+
|
144
|
+
- Add support for rails 4
|
145
|
+
|
146
|
+
- Refactor code
|
147
|
+
|
148
|
+
- Add support for precompiled assets
|
149
|
+
|
150
|
+
- No longer include default `email.css`
|
151
|
+
|
152
|
+
## v1.1.0
|
153
|
+
|
154
|
+
- Fixed several bugs
|
155
|
+
|
156
|
+
- Strip asset digest from CSS path
|
157
|
+
|
158
|
+
- Improve nokogiri support
|
159
|
+
|
160
|
+
- Request CSS file if asset is not found locally
|
161
|
+
|
162
|
+
This allows you to host all your assets on a CDN and deploy the
|
163
|
+
app without the `app/assets` folder.
|
164
|
+
|
165
|
+
Thanks to everyone who contributed!
|
data/Gemfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
rails_version = ENV.fetch('ACTION_MAILER_VERSION', '6')
|
6
|
+
|
7
|
+
if rails_version == 'master'
|
8
|
+
git 'git://github.com/rails/rails.git' do
|
9
|
+
gem 'rails'
|
10
|
+
end
|
11
|
+
gem 'sprockets-rails', github: 'rails/sprockets-rails'
|
12
|
+
gem 'arel', github: 'rails/arel'
|
13
|
+
elsif rails_version.split('.').first.to_i >= 7
|
14
|
+
gem 'rails', "~> #{rails_version}"
|
15
|
+
gem ENV.fetch("ASSETS_GEM", "sprockets-rails")
|
16
|
+
else
|
17
|
+
gem 'rails', "~> #{rails_version}"
|
18
|
+
end
|
19
|
+
|
20
|
+
gem 'byebug'
|
21
|
+
gem 'net-smtp', require: false
|
22
|
+
|
23
|
+
# platforms :rbx do
|
24
|
+
# gem 'rubysl'
|
25
|
+
# gem 'racc'
|
26
|
+
# end
|
27
|
+
|
28
|
+
gem 'tins', '< 1.7' if RUBY_VERSION.split('.').first.to_i < 2
|
data/LICENSE
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright (C) 2011-2012 Philipe Fatio (fphilipe)
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
4
|
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
5
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
6
|
+
persons to whom the Software is furnished to do so, subject to the following conditions:
|
7
|
+
|
8
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
9
|
+
the Software.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
12
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
13
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
14
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# premailer-rails
|
2
|
+
|
3
|
+
CSS styled emails without the hassle.
|
4
|
+
|
5
|
+
[![Gem Version][gem-image]][gem-link]
|
6
|
+
[![Code Climate][gpa-image]][gpa-link]
|
7
|
+
[![Coverage Status][cov-image]][cov-link]
|
8
|
+
|
9
|
+
## Introduction
|
10
|
+
|
11
|
+
This gem is a drop in solution for styling HTML emails with CSS without having
|
12
|
+
to do the hard work yourself.
|
13
|
+
|
14
|
+
Styling emails is not just a matter of linking to a stylesheet. Most clients,
|
15
|
+
especially web clients, ignore linked stylesheets or `<style>` tags in the HTML.
|
16
|
+
The workaround is to write all the CSS rules in the `style` attribute of each
|
17
|
+
tag inside your email. This is a rather tedious and hard to maintain approach.
|
18
|
+
|
19
|
+
Premailer to the rescue! The great [premailer] gem applies all CSS rules to each
|
20
|
+
matching HTML element by adding them to the `style` attribute. This allows you
|
21
|
+
to keep HTML and CSS in separate files, just as you're used to from web
|
22
|
+
development, thus keeping your sanity.
|
23
|
+
|
24
|
+
This gem is an adapter for premailer to work with [actionmailer] out of the box.
|
25
|
+
Actionmailer is the email framework used in Rails, which also works outside of
|
26
|
+
Rails. Although premailer-rails has certain Rails specific features, **it also
|
27
|
+
works in the absence of Rails** making it compatible with other frameworks such
|
28
|
+
as sinatra.
|
29
|
+
|
30
|
+
## How It Works
|
31
|
+
|
32
|
+
premailer-rails works with actionmailer by registering a delivery hook. This
|
33
|
+
causes all emails that are delivered to be processed by premailer-rails. This
|
34
|
+
means that by simply including premailer-rails in your `Gemfile` you'll get
|
35
|
+
styled emails without having to set anything up.
|
36
|
+
|
37
|
+
Whenever premailer-rails processes an email, it collects the URLs of all linked
|
38
|
+
stylesheets (`<link rel="stylesheet" href="css_url">`). Then, for each of these
|
39
|
+
URLs, it tries to get the content through a couple of strategies. As long as
|
40
|
+
a strategy does not return anything, the next one is used. The strategies
|
41
|
+
available are:
|
42
|
+
|
43
|
+
- `:filesystem`: If there's a file inside `public/` with the same path as in
|
44
|
+
the URL, it is read from disk. E.g. if the URL is
|
45
|
+
`http://cdn.example.com/assets/email.css` the contents of the file located
|
46
|
+
at `public/assets/email.css` gets returned if it exists.
|
47
|
+
|
48
|
+
- `:asset_pipeline`: If Rails is available and the asset pipeline is enabled,
|
49
|
+
the file is retrieved through the asset pipeline. E.g. if the URL is
|
50
|
+
`http://cdn.example.com/assets/email-fingerprint123.css`, the file
|
51
|
+
`email.css` is requested from the asset pipeline. That is, the fingerprint
|
52
|
+
and the prefix (in this case `assets` is the prefix) are stripped before
|
53
|
+
requesting it from the asset pipeline.
|
54
|
+
|
55
|
+
- `:network`: As a last resort, the URL is simply requested and the response
|
56
|
+
body is used. This is useful when the assets are not bundled in the
|
57
|
+
application and only available on a CDN. On Heroku e.g. you can add assets
|
58
|
+
to your `.slugignore` causing your assets to not be available to the app
|
59
|
+
(and thus resulting in a smaller app) and deploy the assets to a CDN such
|
60
|
+
as S3/CloudFront.
|
61
|
+
|
62
|
+
You can configure which strategies you want to use as well as specify their
|
63
|
+
order. Refer to the *Configuration* section for more on this.
|
64
|
+
|
65
|
+
Note that the retrieved CSS is cached when the gem is running with Rails in
|
66
|
+
production.
|
67
|
+
|
68
|
+
## Installation
|
69
|
+
|
70
|
+
Simply add the gem to your `Gemfile`:
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
gem 'premailer-rails'
|
74
|
+
```
|
75
|
+
|
76
|
+
premailer-rails and premailer require a gem that is used to parse the email's
|
77
|
+
HTML. For a list of supported gems and how to select which one to use, please
|
78
|
+
refer to the [*Adapter*
|
79
|
+
section](https://github.com/premailer/premailer#adapters) of premailer. Note
|
80
|
+
that there is no hard dependency from either gem so you should add one yourself.
|
81
|
+
Also note that this gem is only tested with [nokogiri].
|
82
|
+
|
83
|
+
## Configuration
|
84
|
+
|
85
|
+
Premailer itself accepts a number of options. In order for premailer-rails to
|
86
|
+
pass these options on to the underlying premailer instance, specify them
|
87
|
+
as follows (in Rails you could do that in an initializer such as
|
88
|
+
`config/initializers/premailer_rails.rb`):
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
Premailer::Rails.config.merge!(preserve_styles: true, remove_ids: true)
|
92
|
+
```
|
93
|
+
|
94
|
+
For a list of options, refer to the [premailer documentation]. The default
|
95
|
+
configs are:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
{
|
99
|
+
input_encoding: 'UTF-8',
|
100
|
+
generate_text_part: true,
|
101
|
+
strategies: [:filesystem, :asset_pipeline, :network]
|
102
|
+
}
|
103
|
+
```
|
104
|
+
|
105
|
+
If you don't want to automatically generate a text part from the html part, set
|
106
|
+
the config `:generate_text_part` to false.
|
107
|
+
|
108
|
+
Note that the options `:with_html_string` and `:css_string` are used internally
|
109
|
+
by premailer-rails and thus will be overridden.
|
110
|
+
|
111
|
+
If you're using this gem outside of Rails, you'll need to call
|
112
|
+
`Premailer::Rails.register_interceptors` manually in order for it to work. This
|
113
|
+
is done ideally in some kind of initializer, depending on the framework you're
|
114
|
+
using.
|
115
|
+
|
116
|
+
premailer-rails reads all stylesheet `<link>` tags, inlines the linked CSS
|
117
|
+
and removes the tags. If you wish to ignore a certain tag, e.g. one that links to
|
118
|
+
external fonts such as Google Fonts, you can add a `data-premailer="ignore"`
|
119
|
+
attribute.
|
120
|
+
|
121
|
+
## Usage
|
122
|
+
|
123
|
+
premailer-rails processes all outgoing emails by default. If you wish to skip
|
124
|
+
premailer for a certain email, simply set the `:skip_premailer` header:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
class UserMailer < ActionMailer::Base
|
128
|
+
def welcome_email(user)
|
129
|
+
mail to: user.email,
|
130
|
+
subject: 'Welcome to My Awesome Site',
|
131
|
+
skip_premailer: true
|
132
|
+
end
|
133
|
+
end
|
134
|
+
```
|
135
|
+
|
136
|
+
Note that the mere presence of this header causes premailer to be skipped, i.e.,
|
137
|
+
even setting `skip_premailer: false` will cause premailer to be skipped. The
|
138
|
+
reason for that is that the `skip_premailer` is a simple header and the value is
|
139
|
+
transformed into a string, causing `'false'` to become truthy.
|
140
|
+
|
141
|
+
Emails are only processed upon delivery, i.e. when calling `#deliver` on the
|
142
|
+
email, or when [previewing them in
|
143
|
+
rails](http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Previewing+emails).
|
144
|
+
If you wish to manually trigger the inlining, you can do so by calling the hook:
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
mail = SomeMailer.some_message(args)
|
148
|
+
Premailer::Rails::Hook.perform(mail)
|
149
|
+
```
|
150
|
+
|
151
|
+
This will modify the email in place, useful e.g. in tests.
|
152
|
+
|
153
|
+
## Small Print
|
154
|
+
|
155
|
+
### Author
|
156
|
+
|
157
|
+
Philipe Fatio ([@fphilipe][fphilipe twitter])
|
158
|
+
|
159
|
+
### License
|
160
|
+
|
161
|
+
premailer-rails is released under the MIT license. See the [license file].
|
162
|
+
|
163
|
+
|
164
|
+
[gem-image]: https://badge.fury.io/rb/premailer-rails.svg
|
165
|
+
[gem-link]: https://rubygems.org/gems/premailer-rails
|
166
|
+
[gpa-image]: https://codeclimate.com/github/fphilipe/premailer-rails.svg
|
167
|
+
[gpa-link]: https://codeclimate.com/github/fphilipe/premailer-rails
|
168
|
+
[cov-image]: https://coveralls.io/repos/fphilipe/premailer-rails/badge.svg
|
169
|
+
[cov-link]: https://coveralls.io/r/fphilipe/premailer-rails
|
170
|
+
[tip-image]: https://rawgithub.com/twolfson/gittip-badge/0.1.0/dist/gittip.svg
|
171
|
+
[tip-link]: https://www.gittip.com/fphilipe/
|
172
|
+
|
173
|
+
[premailer]: https://github.com/premailer/premailer
|
174
|
+
[actionmailer]: https://github.com/rails/rails/tree/master/actionmailer
|
175
|
+
[nokogiri]: https://github.com/sparklemotion/nokogiri
|
176
|
+
|
177
|
+
[premailer documentation]: https://www.rubydoc.info/gems/premailer/Premailer:initialize
|
178
|
+
|
179
|
+
[fphilipe twitter]: https://twitter.com/fphilipe
|
180
|
+
[license file]: LICENSE
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.12.0
|
data/example/.gitignore
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-journal
|
13
|
+
|
14
|
+
# Ignore all logfiles and tempfiles.
|
15
|
+
/log/*.log
|
16
|
+
/tmp
|
data/example/Gemfile
ADDED
data/example/README.md
ADDED
data/example/Rakefile
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
body {
|
2
|
+
background: #efefef;
|
3
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
4
|
+
}
|
5
|
+
|
6
|
+
p {
|
7
|
+
line-height: 1.4;
|
8
|
+
}
|
9
|
+
|
10
|
+
.wrap {
|
11
|
+
max-width: 40em;
|
12
|
+
margin: 0 auto;
|
13
|
+
padding: 1em;
|
14
|
+
background: white;
|
15
|
+
}
|
16
|
+
|
17
|
+
.greeting {
|
18
|
+
text-align: center;
|
19
|
+
font-weight: bold;
|
20
|
+
font-size: 110%;
|
21
|
+
}
|
22
|
+
|
23
|
+
.footer {
|
24
|
+
font-size: 90%;
|
25
|
+
color: #666;
|
26
|
+
}
|
27
|
+
|
28
|
+
a {
|
29
|
+
color: green;
|
30
|
+
text-decoration: none;
|
31
|
+
border-bottom: 2px solid green;
|
32
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset='utf-8'>
|
5
|
+
<%= stylesheet_link_tag :email %>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div class='wrap'>
|
9
|
+
<p class='greeting'>Hi, John Doe</p>
|
10
|
+
<p>
|
11
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
12
|
+
</p>
|
13
|
+
<div class='footer'>
|
14
|
+
To unsubscribe, <a href='http://www.google.com/'>click here</a>.
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
</body>
|
18
|
+
</html>
|
data/example/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'action_controller/railtie'
|
4
|
+
require 'action_mailer/railtie'
|
5
|
+
require 'sprockets/railtie'
|
6
|
+
|
7
|
+
Bundler.require(*Rails.groups)
|
8
|
+
|
9
|
+
module Example
|
10
|
+
class Application < Rails::Application
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config.cache_classes = false
|
3
|
+
config.eager_load = false
|
4
|
+
config.consider_all_requests_local = true
|
5
|
+
config.action_controller.perform_caching = false
|
6
|
+
config.assets.debug = true
|
7
|
+
config.assets.digest = true
|
8
|
+
config.assets.raise_runtime_errors = true
|
9
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
config.cache_classes = true
|
3
|
+
config.eager_load = true
|
4
|
+
config.consider_all_requests_local = false
|
5
|
+
config.action_controller.perform_caching = true
|
6
|
+
config.assets.compile = false
|
7
|
+
config.assets.digest = true
|
8
|
+
config.log_level = :info
|
9
|
+
end
|
data/example/config.ru
ADDED