PERF: Concatenate scripts in development mode

This improves my DOMContentLoaded from 9s+ to less than 4s.
Pinging @SamSaffron on this because this was previously controversial.

This implementation adds the `@sourceURL` directive so chrome correctly
identifies the source files.
This commit is contained in:
Robin Ward
2015-04-16 15:40:23 -04:00
parent e912b698ac
commit c7d367996a
3 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,7 @@ class DiscourseIIFE < Sprockets::Processor
.sub("/app/assets/javascripts", "")
.sub("/test/javascripts", "")
res << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['/assets#{req_path}'] = #{data.to_json};\n"
res << "\n//@ sourceURL=/#{context.logical_path}\n"
end
res