Skip to content

Commit cba3c00

Browse files
committed
partial pass over the assets guide
1 parent f3b8cd9 commit cba3c00

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

railties/guides/source/asset_pipeline.textile

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ h3. In Development
261261

262262
In development mode assets are served as separate files in the order they are specified in the manifest file.
263263

264-
This manifest +application.js+:
264+
This manifest +app/assets/javascripts/application.js+:
265265

266266
<plain>
267267
//= require core
@@ -272,45 +272,42 @@ This manifest +application.js+:
272272
would generate this HTML:
273273

274274
<html>
275-
<script src='/assets/core.js?body=1'></script>
276-
<script src='/assets/projects.js?body=1'></script>
277-
<script src='/assets/tickets.js?body=1'></script>
275+
<script src="/assets/core.js?body=1" type="text/javascript"></script>
276+
<script src="/assets/projects.js?body=1" type="text/javascript"></script>
277+
<script src="/assets/tickets.js?body=1" type="text/javascript"></script>
278278
</html>
279279

280280
The +body+ param is required by Sprockets.
281281

282282
h4. Turning Debugging off
283283

284-
You can turn off debug mode by updating +development.rb+ to include:
284+
You can turn off debug mode by updating +config/environments/development.rb+ to include:
285285

286-
<erb>
286+
<ruby>
287287
config.assets.debug = false
288-
</erb>
288+
</ruby>
289289

290-
When debug mode is off Sprockets will concatenate and run the necessary preprocessors on all files, generating the following HTML:
290+
When debug mode is off Sprockets concatenates and runs the necessary preprocessors on all files. With debug mode turned off the manifest above would generate instead:
291291

292292
<html>
293-
<script src='/assets/application.js'></script>
293+
<script src="/assets/application.js" type="text/javascript"></script>
294294
</html>
295295

296-
Assets are compiled and cached on the first request after the server is started. Sprockets sets a +must-revalidate+ Cache-Control HTTP header to reduce request overhead on subsequent requests -- on these the browser gets a 304 (not-modified) response.
296+
Assets are compiled and cached on the first request after the server is started. Sprockets sets a +must-revalidate+ Cache-Control HTTP header to reduce request overhead on subsequent requests -- on these the browser gets a 304 (Not Modified) response.
297297

298298
If any of the files in the manifest have changed between requests, the server responds with a new compiled file.
299299

300-
You can put +?debug_assets=true+ or +?debug_assets=1+ at the end of a URL to enable debug mode on-demand, and this will render individual tags for each file. This is useful for tracking down exact line numbers when debugging.
301-
302-
Debug can also be set in the Rails helper methods:
300+
Debug mode can also be enabled in the Rails helper methods:
303301

304302
<erb>
305303
<%= stylesheet_link_tag "application", :debug => true %>
306304
<%= javascript_include_tag "application", :debug => true %>
307305
</erb>
308306

309-
The +:debug+ option is ignored if the debug mode is off.
307+
The +:debug+ option is redundant if debug mode is on.
310308

311309
You could potentially also enable compression in development mode as a sanity check, and disable it on-demand as required for debugging.
312310

313-
314311
h3. In Production
315312

316313
In the production environment Rails uses the fingerprinting scheme outlined above. By default it is assumed that assets have been precompiled and will be served as static assets by your web server.

0 commit comments

Comments
 (0)