Search code examples
ruby-on-railsbootstrap-4actionmailerpremailer

Bootstrap for email styling with Rails 5 in API mode


I have a Rails 5 API app. I'd like to be able to send styled emails using Bootstrap, but after adding gem boostrap to my Gemfile and running bundle install I get this error:

 7:in `method_missing': undefined method `assets' for #Rails::Application::Configuration:0x0000555adc2497f8> (NoMethodError)

What do I have to do to so I can use the bootstrap gem in my API app?


Solution

  • For those still looking into this question

    You will have to uncomment "require 'sprockets/railtie'" from your application.rb file.

    Then add manijest.js file in 'app/assets/config/manifest.js' and link your directories in that file

    //= link_tree ../images
    //= link_directory ../javascripts .js
    //= link_directory ../stylesheets .css
    

    For more info, you can check out the rails asset pipeline documentation