aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorMatthew Draper <matthew@trebex.net>2014-04-11 02:28:35 +0930
committerMatthew Draper <matthew@trebex.net>2014-04-11 22:47:54 +0930
commitf612c2b0526e326eb6c25a7bbf375ac3ac793a3c (patch)
tree508cd469311970ac48d0fcc48602ee0a726da4d2 /guides
parentd8d0fcb06aae164b57695749ee394eee6996ee4d (diff)
downloadrails-f612c2b0526e326eb6c25a7bbf375ac3ac793a3c.tar.gz
rails-f612c2b0526e326eb6c25a7bbf375ac3ac793a3c.tar.bz2
rails-f612c2b0526e326eb6c25a7bbf375ac3ac793a3c.zip
Move assets precompile (and version) to an initializer
sprockets-rails 2.1 needs the precompile list to be available in all environments.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/asset_pipeline.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 9338f570a7..d688bb7b4e 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -709,17 +709,17 @@ JS/CSS is excluded, as well as raw JS/CSS files; for example, `.coffee` and
`.scss` files are **not** automatically included as they compile to JS/CSS.
If you have other manifests or individual stylesheets and JavaScript files to
-include, you can add them to the `precompile` array in `config/application.rb`:
+include, you can add them to the `precompile` array in `config/initializers/assets.rb`:
```ruby
-config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']
+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/application.rb
-config.assets.precompile << Proc.new do |path|
+# 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