Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More intelligent asset precompilation #394

Closed
devvmh opened this issue Jun 7, 2016 · 4 comments
Closed

More intelligent asset precompilation #394

devvmh opened this issue Jun 7, 2016 · 4 comments

Comments

@devvmh
Copy link
Contributor

devvmh commented Jun 7, 2016

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.

@freemanoid
Copy link

freemanoid commented Jul 5, 2016

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.

@devvmh
Copy link
Contributor Author

devvmh commented Jul 6, 2016

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.

@freemanoid
Copy link

Thanks. Nice catch!

@d4be4st
Copy link
Member

d4be4st commented Jul 8, 2016

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

@d4be4st d4be4st closed this as completed Jul 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants