Im trying to install the inky-rb gem to use the foundation-email themes in rails API-Only. This api only read/send data but we want to send emails for user from her.
I aready added the gem
# Preprocessor for email HTML to convert components in table structure https://get.foundation/emails/docs/gem-guide.html
gem 'inky-rb', require: 'inky'
# Stylesheet inlining for email (used by inky)
gem 'premailer-rails'
but when run
rails g inky:install
And added the foundation_emails.scss the ruby on rails email preview breaks
so i aready try uncomment
require 'action_view/railtie'
in application.rb and add config.assets.precompile += ['foundation_email.css' ]
in the same file.
but now when i go to mailers preview i recive this error
LoadError in Rails::MailersController#preview
cannot load such file -- sassc
To try solve this i tried added the gem
gem 'sprockets', '~> 4.0'
gem 'sassc-rails'
but din't worked
So this is what you should do
1 - Create you mailer with
rails g mailer folder_name email_name
2 - Add the inky-rb, sassc-rails and sprockets gems in your Gemfile.
gem 'inky-rb', require: 'inky'
gem 'sprockets'
gem 'premailer-rails'
gem 'sassc-rails'
For install the gems run bundle install and after rails s
3 - now you have to install the inky whit
rails g inky:install
OBS: This add to arquives foundation_emails.scss
the ruby on rails email preview breaks css and a new mailer layout
4 - in aplication.rb
uncomment require sprockets/railtie
and add after the line config.api_only = true
config.assets.precompile += %w( foundation_mails.css )
you al so need to add a manifest.js inside assets/config
//= link_directory ../stylesheets .css
5 - Now in views/folder_name_mailer you change the file name, from email_name.html.erb to email_name.html.inky and add one layout like this one
<container>
<columns>
<spacer size="16"></spacer>
<h4 class="text-center"> This Works \0/ </h4>
</columns>
</row>
</container>
6- you can watch your changes in localhost:3000/rails/mailers/folder_name_mailer/email_name.html
This tutorial for full Ruby and Rails helped me alot to fix this problem Mail Previews and Templates Tutorial in Youtube