diff --git a/Gemfile.lock b/Gemfile.lock index ef854e0..3a97d73 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,21 +1,21 @@ PATH remote: . specs: - inky-rb (0.0.3) + inky-rb (1.3.6.0) 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..a75e633 100644 --- a/README.md +++ b/README.md @@ -74,25 +74,25 @@ Ensure your mailer layout has the following structure: - - - - - - - - - - - - - -
-
- <%= yield %> -
-
- + + + + + + <%= stylesheet_link_tag "your_emails_stylesheet" %> + + + + + + + +
+
+ <%= yield %> +
+
+ ``` diff --git a/lib/generators/inky/install_generator.rb b/lib/generators/inky/install_generator.rb new file mode 100644 index 0000000..86df989 --- /dev/null +++ b/lib/generators/inky/install_generator.rb @@ -0,0 +1,29 @@ +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 => 'inky_mailer', :banner => 'layout_name' + + 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 %> +
+
+ +