My rails app is working but its slug size is huge (220mb).
I am storing all assets on cloudfront with config.assets.digest = true and config.action\_controller.asset\_host = "something.cloudfront.net"

> 
> heroku run bash
> 
> 
> 

In the slug, there is 30 times application-onedigest.js in public/assets, and same thing for stylesheets and images, so now the slug size is 220 mb.

Maybe one of my gem is doing middleware things ([Rails asset\_host, cloudfront and heroku](https://stackoverflow.com/questions/22571375/rails-asset-host-cloudfront-and-heroku)) or maybe heroku is trying to optimize things (<https://devcenter.heroku.com/changelog-items/328>), but i don't think so. I don't want to exceed the maximum heroku slug size that is 300 mb, and i feel that is not normal.

How to remove old rails assets on heroku ?

**EDIT**
I made little commits in a css file, push to heroku, and compared slug. In the deploy process, there is those lines:

```
Running: rake assets:precompile
INFO -- : Writing /tmp/build_ff4eb6d7-303e-444d-9c88-938ab504ea8a/public/assets/application-700c7e1849c55312a94a353e60312500.css
Asset precompilation completed (9.60s)
Cleaning assets
Running: rake assets:clean
INFO -- : Removed application-48375ba5495e14b36afab9d4b9d97033.css

```

This is what i want. But when i compare the old and the new slug, there is the new `application-700....css`, and an another new mysterious `application-a9b33ae58934ad161038cb3ebcee146c.css`
And this one is actually used is the heroku webapp (when i explore css resources from the browser, after clearing cache).
So i guess precompile is done twice somewhere?

Temporary solution : `heroku fork` the app, i am back to 40 mb but there is still the problem.

**EDIT**
It seems it works when i precompile locally, but i don't like it as it violates 12factors.