Sprockets manifest doesn't match compiled files
I'm trying to extend assets:precompile task to add support for source maps.
If you want to take a look at the code, check this gist.
What I have noticed, and that is a problem for what I am trying to do, is that the filenames contained in the manifest doesn't match what sprockets actually generates.
For example, this is what I can find in the sprockets manifest:
{"files":
{"i18n-313d99d642990c78cdc5d087efeab00bcf16aa19e0fdedbaa201fca1263ec480.js": …
This is what I actually have in public/assets:
i18n-a6a3c5f7de87d6594e152f96a7ea4ca131a916e30eb0d83769aac67948cb4b93.js
I'd like to understand what is going on here because it seems wrong to me but my best bet is that I am missing something.
$ rake about
Running via Spring preloader in process 52591
About your application's environment
Rails version 4.2.6
Ruby version 2.3.0-p0 (x86_64-darwin14)
RubyGems version 2.5.1
Rack version 1.6.4
JavaScript Runtime therubyracer (V8)
Middleware Raven::Rack, Rack::Attack, Rack::Sendfile, ActionDispatch::Static, Rack::Lock, Rack::Rewrite, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, BetterErrors::Middleware, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, RedisSessionStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag, Warden::Manager, OmniAuth::Strategies::GoogleOauth2, OmniAuth::Strategies::Twitch, OmniAuth::Strategies::Instagram
Application root /Users/adrien/code/octoly
Environment development
Database adapter postgresql
Database schema version 20160531124056
Can you give me an example app that reproduces the problem? What version of sprockets are you using? Are you building your own custom compile task like in that gist or getting the same mis-match with another lib like rails and sprockets-rails
I'm trying to extend assets:precompile task to add support for source maps.
Can you use Sprockets 4 beta instead? It has source map support.
@schneems I'm using Sprockets 4 beta now. although I can get the source map in development environment, but I cannot find the *.map files on production.
Source maps are enabled by a flag config.assets.debug = true this triggers the "debug" pipeline in sprockets https://github.com/rails/sprockets/blob/master/lib/sprockets.rb#L107
Unfortunately this debug flag also means other things to https://github.com/rails/sprockets-rails. So you might see additional changes in addition to getting source maps. Asset lookup may be slower.
In the future we should add a method for specifying that we only want sourcemaps enabled, but none of the other "debug" features. I.e. debug should always give us sourcemaps, but we need a way to get sourcemaps without "debug".