@@ -78,9 +78,9 @@ requests can mean faster loading for your application.
7878Sprockets concatenates all JavaScript files into one master ` .js ` file and all
7979CSS files into one master ` .css ` file. As you'll learn later in this guide, you
8080can customize this strategy to group files any way you like. In production,
81- Rails inserts an MD5 fingerprint into each filename so that the file is cached
82- by the web browser. You can invalidate the cache by altering this fingerprint,
83- which happens automatically whenever you change the file contents.
81+ Rails inserts an SHA256 fingerprint into each filename so that the file is
82+ cached by the web browser. You can invalidate the cache by altering this
83+ fingerprint, which happens automatically whenever you change the file contents.
8484
8585The second feature of the asset pipeline is asset minification or compression.
8686For CSS files, this is done by removing whitespace and comments. For JavaScript,
@@ -346,9 +346,9 @@ Provided that the pipeline is enabled within your application (and not disabled
346346in the current environment context), this file is served by Sprockets. If a file
347347exists at ` public/assets/rails.png ` it is served by the web server.
348348
349- Alternatively, a request for a file with an MD5 hash such as
350- ` public/assets/rails-af27b6a414e6da00003503148be9b409 .png ` is treated the same
351- way. How these hashes are generated is covered in the [ In
349+ Alternatively, a request for a file with an SHA256 hash such as
350+ ` public/assets/rails-f90d8a84c707a8dc923fca1ca1895ae8ed0a09237f6992015fef1e11be77c023 .png `
351+ is treated the same way. How these hashes are generated is covered in the [ In
352352Production] ( #in-production ) section later on in this guide.
353353
354354Sprockets will also look through the paths specified in ` config.assets.paths ` ,
@@ -654,7 +654,7 @@ In the production environment Sprockets uses the fingerprinting scheme outlined
654654above. By default Rails assumes assets have been precompiled and will be
655655served as static assets by your web server.
656656
657- During the precompilation phase an MD5 is generated from the contents of the
657+ During the precompilation phase an SHA256 is generated from the contents of the
658658compiled files, and inserted into the filenames as they are written to disk.
659659These fingerprinted names are used by the Rails helpers in place of the manifest
660660name.
@@ -743,22 +743,24 @@ Rails.application.config.assets.precompile += %w( admin.js admin.css )
743743NOTE. Always specify an expected compiled filename that ends with .js or .css,
744744even if you want to add Sass or CoffeeScript files to the precompile array.
745745
746- The task also generates a ` manifest-md5hash.json ` that contains a list with
747- all your assets and their respective fingerprints. This is used by the Rails
748- helper methods to avoid handing the mapping requests back to Sprockets. A
749- typical manifest file looks like:
746+ The task also generates a ` .sprockets- manifest-md5hash.json` (where ` md5hash ` is
747+ a MD5 hash) that contains a list with all your assets and their respective
748+ fingerprints. This is used by the Rails helper methods to avoid handing the
749+ mapping requests back to Sprockets. A typical manifest file looks like:
750750
751751``` ruby
752- {" files" :{" application-723d1be6cc741a3aabb1cec24276d681.js" :{" logical_path" :"application.js" ," mtime" :"2013-07-26T22:55:03-07:00" ," size" :302506 ,
753- " digest" :"723d1be6cc741a3aabb1cec24276d681" }," application-12b3c7dd74d2e9df37e7cbb1efa76a6d.css" :{" logical_path" :"application.css" ," mtime" :"2013-07-26T22:54:54-07:00" ," size" :1560 ,
754- " digest" :"12b3c7dd74d2e9df37e7cbb1efa76a6d" }," application-1c5752789588ac18d7e1a50b1f0fd4c2.css" :{" logical_path" :"application.css" ," mtime" :"2013-07-26T22:56:17-07:00" ," size" :1591 ,
755- " digest" :"1c5752789588ac18d7e1a50b1f0fd4c2" }," favicon-a9c641bf2b81f0476e876f7c5e375969.ico" :{" logical_path" :"favicon.ico" ," mtime" :"2013-07-26T23:00:10-07:00" ," size" :1406 ,
756- " digest" :"a9c641bf2b81f0476e876f7c5e375969" }," my_image-231a680f23887d9dd70710ea5efd3c62.png" :{" logical_path" :"my_image.png" ," mtime" :"2013-07-26T23:00:27-07:00" ," size" :6646 ,
757- " digest" :"231a680f23887d9dd70710ea5efd3c62" }}," assets" :{" application.js" :
758- " application-723d1be6cc741a3aabb1cec24276d681.js" ," application.css" :
759- " application-1c5752789588ac18d7e1a50b1f0fd4c2.css" ,
760- " favicon.ico" :"favicona9c641bf2b81f0476e876f7c5e375969.ico" ," my_image.png" :
761- " my_image-231a680f23887d9dd70710ea5efd3c62.png" }}
752+ {" files" :{" application-aee4be71f1288037ae78b997df388332edfd246471b533dcedaa8f9fe156442b.js" :{" logical_path" :"application.js" ," mtime" :"2016-12-23T20:12:03-05:00" ," size" :412383 ,
753+ " digest" :"aee4be71f1288037ae78b997df388332edfd246471b533dcedaa8f9fe156442b" ," integrity" :"sha256-ruS+cfEogDeueLmX3ziDMu39JGRxtTPc7aqPn+FWRCs=" },
754+ " application-86a292b5070793c37e2c0e5f39f73bb387644eaeada7f96e6fc040a028b16c18.css" :{" logical_path" :"application.css" ," mtime" :"2016-12-23T19:12:20-05:00" ," size" :2994 ,
755+ " digest" :"86a292b5070793c37e2c0e5f39f73bb387644eaeada7f96e6fc040a028b16c18" ," integrity" :"sha256-hqKStQcHk8N+LA5fOfc7s4dkTq6tp/lub8BAoCixbBg=" },
756+ " favicon-8d2387b8d4d32cecd93fa3900df0e9ff89d01aacd84f50e780c17c9f6b3d0eda.ico" :{" logical_path" :"favicon.ico" ," mtime" :"2016-12-23T20:11:00-05:00" ," size" :8629 ,
757+ " digest" :"8d2387b8d4d32cecd93fa3900df0e9ff89d01aacd84f50e780c17c9f6b3d0eda" ," integrity" :"sha256-jSOHuNTTLOzZP6OQDfDp/4nQGqzYT1DngMF8n2s9Dto=" },
758+ " my_image-f4028156fd7eca03584d5f2fc0470df1e0dbc7369eaae638b2ff033f988ec493.png" :{" logical_path" :"my_image.png" ," mtime" :"2016-12-23T20:10:54-05:00" ," size" :23414 ,
759+ " digest" :"f4028156fd7eca03584d5f2fc0470df1e0dbc7369eaae638b2ff033f988ec493" ," integrity" :"sha256-9AKBVv1+ygNYTV8vwEcN8eDbxzaequY4sv8DP5iOxJM=" }},
760+ " assets" :{" application.js" :"application-aee4be71f1288037ae78b997df388332edfd246471b533dcedaa8f9fe156442b.js" ,
761+ " application.css" :"application-86a292b5070793c37e2c0e5f39f73bb387644eaeada7f96e6fc040a028b16c18.css" ,
762+ " favicon.ico" :"favicon-8d2387b8d4d32cecd93fa3900df0e9ff89d01aacd84f50e780c17c9f6b3d0eda.ico" ,
763+ " my_image.png" :"my_image-f4028156fd7eca03584d5f2fc0470df1e0dbc7369eaae638b2ff033f988ec493.png" }}
762764```
763765
764766The default location for the manifest is the root of the location specified in
@@ -850,7 +852,7 @@ config.assets.compile = true
850852
851853On the first request the assets are compiled and cached as outlined in
852854development above, and the manifest names used in the helpers are altered to
853- include the MD5 hash.
855+ include the SHA256 hash.
854856
855857Sprockets also sets the ` Cache-Control ` HTTP header to ` max-age=31536000 ` . This
856858signals all caches between your server and the client browser that this content
0 commit comments