[LRUG] Rails 4 & Assets

Murray Steele murray.steele at gmail.com
Fri Jun 28 02:33:52 PDT 2013


On 27 June 2013 11:03, Oliver Legg <ollylegg at gmail.com> wrote:

> 2. create a custom assets:precompile task that does some bullshit magic to
> make the assets gems available.  I worry about this because "bullshit
> magic".
>
>
> I haven't really looked into this change, but I think I'd go with this
> option. The "bullshit magic" is probably just:
>
>     Rake::Task['environment'].invoke
>     Bundler.require(:assets)
>     Rake::Task['assets:precompile'].invoke
>
> That, if it works, doesn't seem like too much magic.
>
>
I haven't tried that, but you're right, it does seem like not too much
magic.  I did try finding out if you can safely call Bundler.require
multiple times.  The bundler docs are sparse to say the leave and as that
apparently left me the sole option of reading the bundler source code to
work out what it does, I felt that I'd rather die than go spelunking in
there.  Clearly I should have just tried it in the console!

I suppose my real worry is that suddenly you have to do something
*different* to compile the assets.  It's not a big enough worry to avoid
doing it, but I like to minimise anything in an app where doing a standard
rails-y thing has to be done differently for <%= reasons %> as it's a
stumbling block for new developers (or even yourself from the future)

Cheers,

Murray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20130628/82f2aded/attachment.html>


More information about the Chat mailing list