Rails javascript asset missing after precompile

后端 未结 2 1713
北荒
北荒 2020-12-06 12:08

the Rails Guides says:

If there are missing precompiled files in production you will get an Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPre

2条回答
  •  一向
    一向 (楼主)
    2020-12-06 12:32

    Actually two things needed to do:

    config.assets.precompile += %w( *.js *.css )
    

    as described here, and

    config.serve_static_assets = true
    

    for local production testing when using

    rail s
    

    of course using

    rake assets:precompile
    

    however in my case - without config.assets.precompile this would have no effect since the manifest didn't contain any reference to my javascript file.

    HTH.

提交回复
热议问题