Mange / roadie-rails

Making HTML emails comfortable for the Rails rockstars
MIT License
367 stars 66 forks source link

Roadie for Just ActionMailer #22

Closed msaspence closed 10 years ago

msaspence commented 10 years ago

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

msaspence commented 10 years ago

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

Mange commented 10 years ago

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. :-)

msaspence commented 10 years ago

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

Mange commented 10 years ago

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