Skip to content

Commit c1db2af

Browse files
committed
Add Upgrading Your Manifest For Sprocket's 4 as a rails til
1 parent 490c5a2 commit c1db2af

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
99

1010
For a steady stream of TILs, [sign up for my newsletter](https://tinyletter.com/jbranchaud).
1111

12-
_883 TILs and counting..._
12+
_884 TILs and counting..._
1313

1414
---
1515

@@ -559,6 +559,7 @@ _883 TILs and counting..._
559559
- [Test If An Instance Variable Was Assigned](rails/test-if-an-instance-variable-was-assigned.md)
560560
- [Truncate Almost All Tables](rails/truncate-almost-all-tables.md)
561561
- [Update Column Versus Update Attribute](rails/update-column-versus-update-attribute.md)
562+
- [Upgrading Your Manifest For Sprocket's 4](rails/upgrading-your-manifest-for-sprockets-4.md)
562563
- [Where Am I In The Partial Iteration?](rails/where-am-i-in-the-partial-iteration.md)
563564
- [Wipe Out All Precompiled Assets](rails/wipe-out-all-precompiled-assets.md)
564565
- [Write Safer Where Clauses With Placeholders](rails/write-safer-where-clauses-with-placeholders.md)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Upgrading Your Manifest For Sprocket's 4
2+
3+
If you're upgrading [Rails](https://github.com/rails/rails) and it involves
4+
bumping the [Sprockets](https://github.com/rails/sprockets) dependency from 3.x
5+
to 4.x, you may need to update your `manifest.js`.
6+
7+
> Since the default logic for determining top-level targets changed, you might
8+
> find some files that were currently compiled by sprockets for delivery to
9+
> browser no longer are. You will have to edit the `manifest.js` to specify
10+
> those files.
11+
12+
> The `manifest.js` file is meant to specify what files to use as a top-level
13+
> target using sprockets methods `link`, `link_directory`, and `link_tree`.
14+
15+
You can specify what top-level assets like so:
16+
17+
```javascript
18+
# app/assets/config/manifest.js
19+
20+
//= link_tree ../images
21+
//= link_directory ../javascripts .js
22+
//= link_directory ../stylesheets .css
23+
//= link some_file.xml
24+
//= link some/nested/style.css
25+
```
26+
27+
Read more about the [upgrade process
28+
here](https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs)
29+
as well as in [this blog
30+
post](https://eileencodes.com/posts/the-sprockets-4-manifest/).

0 commit comments

Comments
 (0)