Skip to content

Commit

Permalink
Don't recommend to precompile all assets
Browse files Browse the repository at this point in the history
It is very slow since it will precompile even plugins.

Also it is very unlikely that any application will use this patterns
since it is not a good practice to include all assets manually in the
page.

[ci skip]
  • Loading branch information
rafaelfranca committed Feb 27, 2015
1 parent 7878929 commit dd989d0
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions guides/source/asset_pipeline.md
Expand Up @@ -727,27 +727,6 @@ include, you can add them to the `precompile` array in `config/initializers/asse
Rails.application.config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']
```

Or, you can opt to precompile all assets with something like this:

```ruby
# config/initializers/assets.rb
Rails.application.config.assets.precompile << Proc.new do |path|
if path =~ /\.(css|js)\z/
full_path = Rails.application.assets.resolve(path).to_path
app_assets_path = Rails.root.join('app', 'assets').to_path
if full_path.starts_with? app_assets_path
logger.info "including asset: " + full_path
true
else
logger.info "excluding asset: " + full_path
false
end
else
false
end
end
```

NOTE. Always specify an expected compiled filename that ends with .js or .css,
even if you want to add Sass or CoffeeScript files to the precompile array.

Expand Down

0 comments on commit dd989d0

Please sign in to comment.