Rodrigo
Rodrigo

Reputation: 4802

Rails 4 precompiling unwanted files

Rails precompiles unwanted font files, since that .eot, .woff, .svg and .ttf formats aren't in Rails.application.config.assets.precompile list.

/app/assets/stylesheets/subscriber/font-awesome.css.scss

@font-face {
  font-family: 'FontAwesome';
  src: url('fontawesome-webfont.eot?v=3.1.0');
  src: url('fontawesome-webfont.eot?#iefix&v=3.1.0') format('embedded-opentype'),
  url('fontawesome-webfont.woff?v=3.1.0') format('woff'),
  url('fontawesome-webfont.ttf?v=3.1.0') format('truetype'),
  url('fontawesome-webfont.svg#fontawesomeregular?v=3.1.0') format('svg');
  font-weight: normal;
  font-style: normal;
}

And my fonts are placed in app/assets/fonts/subscriber folder.

precompile formats:

$ rails c -e production
Loading production environment (Rails 4.0.2)
2.0.0-p353 :001 > y Rails.application.config.assets.precompile
---
- !ruby/object:Proc {}
- !ruby/regexp /(?:\/|\\|\A)application\.(css|js)$/
- active_admin.js
- active_admin.css
- active_admin/print.css
 => nil 

I have no idea why Rails precompiling them. Any idea?

Upvotes: 0

Views: 62

Answers (1)

zwippie
zwippie

Reputation: 15515

Summary from the Rails Guides:

If you don't want your assets precompiled, put them in the public/assets folder and not in the app/assets folder.

Upvotes: 2

Related Questions