Skip to content

Commit

Permalink
Allow manifest.js to be placed anywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
yubele committed Sep 19, 2020
1 parent 1bf94e2 commit bff8af8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sprockets/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Railtie < ::Rails::Railtie

class ManifestNeededError < StandardError
def initialize
msg = "Expected to find a manifest file in `app/assets/config/manifest.js`\n" +
msg = "Expected to find a manifest file in `manifest.js`\n" +
"But did not, please create this file and use it to link any assets that need\n" +
"to be rendered by your app:\n\n" +
"Example:\n" +
Expand Down Expand Up @@ -103,7 +103,6 @@ def configure(&block)

initializer :set_default_precompile do |app|
if using_sprockets4?
raise ManifestNeededError unless ::Rails.root.join("app/assets/config/manifest.js").exist?
app.config.assets.precompile += %w( manifest.js )
else
app.config.assets.precompile += [LOOSE_APP_ASSETS, /(?:\/|\\|\A)application\.(css|js)$/]
Expand Down Expand Up @@ -212,6 +211,10 @@ def self.build_manifest(app)
end
end

if using_sprockets4?
raise ManifestNeededError if config.assets.find_asset('manifest.js').nil?
end

app.assets_manifest = build_manifest(app)

if config.assets.resolve_with.nil?
Expand Down

0 comments on commit bff8af8

Please sign in to comment.