aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/asset_pipeline.md
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2013-11-11 15:56:09 -0500
committerschneems <richard.schneeman@gmail.com>2013-12-19 20:37:18 -0500
commit2ff2f1ba529ffecb879c723e9a361bacb9e1ea24 (patch)
treef80c5b2d71853c9f85371a8bded4bc90758f6d23 /guides/source/asset_pipeline.md
parentbadcd7bb00a251c23fa59666c0970f8cff0f6cb2 (diff)
downloadrails-2ff2f1ba529ffecb879c723e9a361bacb9e1ea24.tar.gz
rails-2ff2f1ba529ffecb879c723e9a361bacb9e1ea24.tar.bz2
rails-2ff2f1ba529ffecb879c723e9a361bacb9e1ea24.zip
Flag `config.assets.raise_runtime_errors` in dev
By default `config.assets.raise_runtime_errors` should be set to `true` in development for new apps. Source: https://github.com/rails/sprockets-rails/pull/100
Diffstat (limited to 'guides/source/asset_pipeline.md')
-rw-r--r--guides/source/asset_pipeline.md27
1 files changed, 27 insertions, 0 deletions
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 39448e92d5..77189e1442 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -577,6 +577,33 @@ would generate this HTML:
The `body` param is required by Sprockets.
+### Runtime Error Checking
+
+By default the asset pipeline will check for potential errors in development mode during
+runtime. To disable this behavior you can set:
+
+```ruby
+config.assets.raise_runtime_errors = false
+```
+
+When `raise_runtime_errors` is set to `false` sprockets will not check that dependencies of assets are declared properly. Here is a scenario where you must tell the asset pipeline about a dependency:
+
+If you have `application.css.erb` that references `logo.png` like this:
+
+```css
+#logo { background: url(<%= asset_data_uri 'logo.png' %>) }
+```
+
+Then you must declare that `logo.png` is a dependency of `application.css.erb`, so when the image gets re-compiled, the css file does as well. You can do this using the `//= depend_on_asset` declaration:
+
+```css
+//= depend_on_asset "logo.png"
+#logo { background: url(<%= asset_data_uri 'logo.png' %>) }
+```
+
+Without this declaration you may experience strange behavior when pushing to production that is difficult to debug. When you have `raise_runtime_errors` set to `true`, dependencies will be checked at runtime so you can ensure that all dependencies are met.
+
+
### Turning Debugging Off
You can turn off debug mode by updating `config/environments/development.rb` to