Mina: More intelligent asset precompilation

Created on 7 Jun 2016  ·  4Comments  ·  Source: mina-deploy/mina

Our app takes about 200 seconds to deploy when we compile assets, and about 25 seconds when we don't. This means it's very painful to deploy asset changes, and we're always trying to avoid it.

I don't understand sprockets very well, but in another rails app I work with when i run rake assets:precompile manually on the production server, _it only compiles the files that changed_. I really, really wish there was a way to do this with mina

I've tried various hacks to make this happen, like sharing the assets directory between releases. But it seems to be tripped up by a mina assumption that I'm totally blowing away my assets directory every time I run assets precompile.

I'm not sure about a few things:

1) Does this behaviour exist with vanilla rails? If I compile 100 images and one javascript file, change the javascript file, and compile again, will rake only modify the javascript file?
2) Is it possible to get this behaviour to work with mina, for faster deploys?
3) If not currently possible, would a pull request to add this possibility be welcome?

Thanks for any tips. It blows my mind that no one else on the internet seems to be asking about this, so it makes me wonder if I'm missing something obvious.

EDIT: I only just now realized I should provide a very important fact: our app uses sprockets 2.12.4 and sprockets-rails 2.3.3. This may be relevant?

EDIT 2: I tested updating to Sprockets 3. Asset precompilation is much faster (30s - essentially enough to resolve my problem). But as far as I can tell it's still compiling every single asset every time, rather than intelligently compiling only the changed ones. I'd be interested in hearing the expertise of people on this repo.

Most helpful comment

This is fixed in 1.0.0 release. We added tmp/cache to linked dirs so each new precompilation will only precompile the needed files

All 4 comments

I have the same issue:
sprockets (2.12.3)
rails (4.1.8)
mina (0.3.8)

Seems like mina does assets compilation from tmp folder where there is no previous assets, that's why sharing public/assets directory does not work.

Ah, now I see that this issue actually is encapsulated by #380. So I guess the maintainers are aware of this issue.

Maintainers: feel free to close this, or leave open as you like. If I have time I'll start digging into the code a bit to see what might make it work.

Thanks. Nice catch!

This is fixed in 1.0.0 release. We added tmp/cache to linked dirs so each new precompilation will only precompile the needed files

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidhq picture davidhq  ·  10Comments

ghost picture ghost  ·  3Comments

amargherio picture amargherio  ·  10Comments

Bilge picture Bilge  ·  9Comments

ghost picture ghost  ·  12Comments