Skip to content

Commit

Permalink
Use Sprockets 4 for app usage
Browse files Browse the repository at this point in the history
This updates the Gemfile.lock so that this app uses the current version
of Sprockets when it's running directly as an app.

I needed to add an app/assets/config/manifest.js to get around an
error when I'd run `rake app:assets:precompile`:

```
➜  govuk_publishing_components git:(backwards-compatible-sprockets-4) ✗ rake app:assets:precompile
rake aborted!
Sprockets::Railtie::ManifestNeededError: Expected to find a manifest file in `app/assets/config/manifest.js`
But did not, please create this file and use it to link any assets that need
to be rendered by your app:

Example:
  //= link_tree ../images
  //= link_directory ../javascripts .js
  //= link_directory ../stylesheets .css
and restart your server

For more information see: https://github.com/rails/sprockets/blob/070fc01947c111d35bb4c836e9bb71962a8e0595/UPGRADING.md#manifestjs
/Users/kevin.dew/govuk/govuk_publishing_components/spec/dummy/config/environment.rb:5:in `<top (required)>'
Tasks: TOP => environment => app:environment
(See full trace by running task with --trace)
```

This error is peculiar as the app having it's assets precompiled is in
spec/dummy and has it's own manifest.js in spec/dummy/app/assets/config.
Perhaps it's a bug?
  • Loading branch information
kevindew committed Mar 21, 2022
1 parent c5b23f6 commit 1301131
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ GEM
sentry-ruby-core (4.5.2)
concurrent-ruby
faraday
sprockets (3.7.2)
sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
Expand Down
5 changes: 5 additions & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// This file is needed for govuk_publishing_components to support
// app:assets:precompile with Sprockets 4, it will error without it.
//
// See govuk_publishing_components_manifest.js for the list of assets to be
// pre-compiled.
1 change: 0 additions & 1 deletion spec/dummy/config/initializers/assets.rb

This file was deleted.

0 comments on commit 1301131

Please sign in to comment.