diff --git a/Gemfile.lock b/Gemfile.lock
index ef854e0..cdc6af6 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,21 +1,21 @@
PATH
remote: .
specs:
- inky-rb (0.0.3)
+ inky-rb (1.3.6.1)
foundation_emails (~> 2)
GEM
remote: https://rubygems.org/
specs:
diff-lcs (1.2.5)
- foundation_emails (2.1.0.1)
+ foundation_emails (2.2.0.0)
rake (11.2.2)
- rspec-core (3.4.4)
- rspec-support (~> 3.4.0)
- rspec-expectations (3.4.0)
+ rspec-core (3.5.0)
+ rspec-support (~> 3.5.0)
+ rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
- rspec-support (~> 3.4.0)
- rspec-support (3.4.1)
+ rspec-support (~> 3.5.0)
+ rspec-support (3.5.0)
PLATFORMS
ruby
@@ -28,4 +28,4 @@ DEPENDENCIES
rspec-expectations
BUNDLED WITH
- 1.12.4
+ 1.11.2
diff --git a/README.md b/README.md
index a795bca..b3d1dfa 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,11 @@
# Inky
+[![Gem Version](https://badge.fury.io/rb/inky-rb.svg)](https://badge.fury.io/rb/inky-rb)
+
Inky is an HTML-based templating language that converts simple HTML into complex, responsive email-ready HTML. Designed for [Foundation for Emails](http://foundation.zurb.com/emails), a responsive email framework from [ZURB](http://zurb.com).
+To include only the Foundation for Emails styles in your Asset Pipeline, without Inky, use the [**foundation_emails**](https://github.com/zurb/foundation-emails/#using-the-ruby-gem) gem.
+
Give Inky simple HTML like this:
```html
@@ -52,14 +56,14 @@ Then execute:
bundle install
```
-Make sure that the stylesheet included in your email layout imports the Foundation for Emails styles:
-
-```scss
-// app/assets/stylesheets/your_emails_stylesheet.scss
+Run the following command to set up the required styles and mailer layout:
-@import "foundation-emails";
+```bash
+rails g inky:install
```
+(You can specify the generated mailer layout filename like so: `rails g inky:install some_name`)
+
Rename your email templates to use the `.inky` file extension. Note that you'll still be able to use ERB within the `.inky` templates:
```
@@ -67,35 +71,6 @@ welcome.html => welcome.html.inky
pw_reset.html.erb => pw_reset.html.inky
```
-Ensure your mailer layout has the following structure:
-
-```html
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%= yield %>
-
-
-
-
-
-
-```
-
You're all set!
** The majority of email clients ignore linked stylesheets. By using a CSS inliner like `premailer-rails` or `roadie`, you're able to leave your stylesheets in a separate file, keeping your markup lean.
diff --git a/lib/generators/inky/install_generator.rb b/lib/generators/inky/install_generator.rb
new file mode 100644
index 0000000..178fee1
--- /dev/null
+++ b/lib/generators/inky/install_generator.rb
@@ -0,0 +1,37 @@
+require 'rails/generators'
+
+module Inky
+ module Generators
+ class InstallGenerator < ::Rails::Generators::Base
+ desc 'Install Foundation for Emails'
+ source_root File.join(File.dirname(__FILE__), 'templates')
+ argument :layout_name, :type => :string, :default => 'mailer', :banner => 'layout_name'
+
+ def preserve_original_mailer_layout
+ return nil unless layout_name == 'mailer'
+
+ original_mailer = File.join(layouts_base_dir, 'mailer.html.erb')
+ rename_filename = File.join(layouts_base_dir, "old_mailer_#{Time.now.to_i}.html.erb")
+ File.rename(original_mailer, rename_filename) if File.exists? original_mailer
+ end
+
+ def create_mailer_stylesheet
+ template 'foundation_emails.scss', File.join(stylesheets_base_dir, 'foundation_emails.scss')
+ end
+
+ def create_mailer_layout
+ template 'mailer_layout.html.erb', File.join(layouts_base_dir, "#{layout_name.underscore}.html.erb")
+ end
+
+ private
+
+ def stylesheets_base_dir
+ File.join('app', 'assets', 'stylesheets')
+ end
+
+ def layouts_base_dir
+ File.join('app', 'views', 'layouts')
+ end
+ end
+ end
+end
diff --git a/lib/generators/inky/templates/foundation_emails.scss b/lib/generators/inky/templates/foundation_emails.scss
new file mode 100644
index 0000000..2c07fd9
--- /dev/null
+++ b/lib/generators/inky/templates/foundation_emails.scss
@@ -0,0 +1 @@
+@import "foundation-emails";
diff --git a/lib/generators/inky/templates/mailer_layout.html.erb b/lib/generators/inky/templates/mailer_layout.html.erb
new file mode 100644
index 0000000..43d8b6f
--- /dev/null
+++ b/lib/generators/inky/templates/mailer_layout.html.erb
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ <%%= stylesheet_link_tag "foundation_emails" %>
+
+
+
+
+
+
+
+ <%%= yield %>
+
+
+
+
+
+
diff --git a/lib/inky/rails/version.rb b/lib/inky/rails/version.rb
index 4bc6828..a7e57e3 100644
--- a/lib/inky/rails/version.rb
+++ b/lib/inky/rails/version.rb
@@ -1,5 +1,5 @@
module Inky
module Rails
- VERSION = "1.3.6.0"
+ VERSION = "1.3.6.1"
end
end