Skip to content
This repository

'public/assets/' directory in .gitignore #2817

wants to merge 1 commit into from

10 participants

Lucas Caton Guillermo Iguaran Jonhnny Weslley Siong Samuel Kadolph Damien Mathieu Piotr Sarnacki Sheldon Hearn Nathan Broadbent Arun Agrawal
Lucas Caton

Should the directory 'public/assets/' be included in .gitignore file?!

Guillermo Iguaran

No, since some people is precompiling assets locally and checkin those in their Git repo

I'm doing in this way to avoid had to use a javascript engine in Heroku. (the rake assets:precompile is having troubles right now in Heroku and they discourage the use of javascript engines in their servers)

Lucas Caton

But it would be the exception rather than the rule, right?

Jonhnny Weslley

I agree with @lucascaton, actually I'm ignoring the public/assets directory too. Since my team deploys to production often several times a day, the git repository can grow faster and we dont like that.


Since "rake assets:precompile" is run on production environment by default, we should not even use this if we are working on localhost as development environment. Hence, "public/assets" directory should not even exists in development environment.

In short, it should not even appear on .gitignore. -1 for this ticket.

Samuel Kadolph

@siong1987 That's incorrect. rake assets:precompile is designed to be run on your development machine where you have all the gems needed to compile them. Then your production environment doesn't need extra gems.


@samuelkadolph True. And, you just provide a valid reason why the "public/assets" directory should not be in .gitignore.

Damien Mathieu

You can't always run precompile on your production machine (heroku for example).
Many people are therefore gonna need to skip this ignore.

@jweslley you can add an assets:clean before running precompile, so your assets directory won't be too big.

-1 on this.

Guillermo Iguaran

@jweslley rake assets:clean assets:precompile

Jonhnny Weslley

@guilleiguaran I already use rake assets:clean assets:precompile, but when I refer to 'too big' in relation to git repository history, not directory size. Anyway, @dmathieu is right and some people really need to generate assets in development machine.

Lucas Caton

Well, I think @jweslley is right about the git repository history size (it'd use twice the space in git repository).

Also I don't see problem to configure the precompilation in production machine.

Piotr Sarnacki

I'm rather against adding it to .gitignore. More people probably want to ignore it, but frankly it's easier to notice that you have not ignored directory then wonder why doesn't it work as advertised if you compile assets (yeah, I know that you need to add it to git, but I'm talking about less experienced developers).

Sheldon Hearn

We're just talking about a default here, right?

Compiled assets are ephemeral. If you lose them, it is trivial to recreate them.

Git repositories are opaque to a lot of developers. If you bloat them, it is trivial to prune them.

If the default isn't what you want, it's recoverable either way. But there's more work to pruning a git repository than there is to recompiling assets.

So it seems to me that the lesser evil is to ignore precompiled assets by default.

Guillermo Iguaran

Totally agree with @drogus, is a -1 on my side

Nathan Broadbent

-1, I think this decision should be left up to the developer. We ignore public/assets, and I'm really against checking in compiled assets, but some people need to do this.

Damien Mathieu

The majority seems to agree on this. Perhaps the issue can be closed ?

Arun Agrawal

Closing this! As most of the :-1: here!

Please get some vote to this PR :-)

Or you can have this in your global gitignore also :-)


Arun Agrawal arunagw closed this April 03, 2012
SAKAMOTO Kazunori exKAZUu referenced this pull request in AI-comp/wpcs May 23, 2013

177 disable button #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 02, 2011
Lucas Caton Include plublic/assets/ in the gitignore file f331010
This page is out of date. Refresh to see the latest.
1  railties/lib/rails/generators/rails/app/templates/gitignore
... ...
@@ -1,5 +1,6 @@
1 1
2 2
3 3
4 5
5 6

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.