Mange/roadie-rails

Roadie for Just ActionMailer

Closed this issue · 4 comments

Whilst there is a load of stuff in roadie-rails that is relevant for Rails applications. It is also possible to use for ActionMailer without Rails. In fact using the following module it is possible get it working automatically.

https://gist.github.com/msaspence/f82b8ae6356d9368a602

(Not a final implementation at all, just a proof of concept)

This isn't so much an issue as it is an idea to expand this gem slightly or create a new roadie-actionmailer gem

There is also AssetPipelineProvider which may be of use to people using Sprockets with out Rails with some modification

Yes, this is very true. I'm not sure how much demand there is and if it's enough to carry the weight of its own gem.
The majority of code in this gem is to handle the configuration object (Roadie::Options) and to automatically hook into Rails.
If you want to use Roadie outside of Rails, it's almost trivial to just implement it yourself. Something like this (excuse my brevity, I'm on my phone)

email = YourMailer.newsletter
email.body = inline_stylesheets(email.body.decoded)
email.deliver 
def inline_stylesheets(html) 
    document = Roadie::Document.new(html)
    # apply your options
    document.transform
end

Something like that. :-)

I will probably end up doing this as bundling roadie-rails means rails is a dependancy which cascades into a huge dependency list of things that the project is not truly "dependant" on

Let me know if you have any problems with the approach. I might look into adding some helper modules or something...