diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-27 14:54:02 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-02-27 14:56:08 -0300 |
commit | 75aa573c8b72febe9f1ba9c9b227b597a55a78a3 (patch) | |
tree | a46f4bd13d16356f323567c90858d0694560b76e /guides/source | |
parent | 6889be526c2c338391d62ff3913af719fff7418d (diff) | |
download | rails-75aa573c8b72febe9f1ba9c9b227b597a55a78a3.tar.gz rails-75aa573c8b72febe9f1ba9c9b227b597a55a78a3.tar.bz2 rails-75aa573c8b72febe9f1ba9c9b227b597a55a78a3.zip |
Don't recommend to precompile all assets
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]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/asset_pipeline.md | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md index 52ea605a72..6f8b4f4d15 100644 --- a/guides/source/asset_pipeline.md +++ b/guides/source/asset_pipeline.md @@ -729,27 +729,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. |