1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00

Add Upgrading Your Manifest For Sprocket's 4 as a rails til

This commit is contained in:
jbranchaud
2019-12-03 12:27:57 -06:00
parent 490c5a2236
commit c1db2af2d0
2 changed files with 32 additions and 1 deletions

View File

@@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
_883 TILs and counting..._
_884 TILs and counting..._
---
@@ -559,6 +559,7 @@ _883 TILs and counting..._
- [Test If An Instance Variable Was Assigned](rails/test-if-an-instance-variable-was-assigned.md)
- [Truncate Almost All Tables](rails/truncate-almost-all-tables.md)
- [Update Column Versus Update Attribute](rails/update-column-versus-update-attribute.md)
- [Upgrading Your Manifest For Sprocket's 4](rails/upgrading-your-manifest-for-sprockets-4.md)
- [Where Am I In The Partial Iteration?](rails/where-am-i-in-the-partial-iteration.md)
- [Wipe Out All Precompiled Assets](rails/wipe-out-all-precompiled-assets.md)
- [Write Safer Where Clauses With Placeholders](rails/write-safer-where-clauses-with-placeholders.md)

View File

@@ -0,0 +1,30 @@
# Upgrading Your Manifest For Sprocket's 4
If you're upgrading [Rails](https://github.com/rails/rails) and it involves
bumping the [Sprockets](https://github.com/rails/sprockets) dependency from 3.x
to 4.x, you may need to update your `manifest.js`.
> Since the default logic for determining top-level targets changed, you might
> find some files that were currently compiled by sprockets for delivery to
> browser no longer are. You will have to edit the `manifest.js` to specify
> those files.
> The `manifest.js` file is meant to specify what files to use as a top-level
> target using sprockets methods `link`, `link_directory`, and `link_tree`.
You can specify what top-level assets like so:
```javascript
# app/assets/config/manifest.js
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link some_file.xml
//= link some/nested/style.css
```
Read more about the [upgrade process
here](https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs)
as well as in [this blog
post](https://eileencodes.com/posts/the-sprockets-4-manifest/).