mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 19:54:14 +08:00
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:
@ -22,7 +22,7 @@ Discourse::Application.configure do
|
|||||||
# Don't Digest assets, makes debugging uglier
|
# Don't Digest assets, makes debugging uglier
|
||||||
config.assets.digest = false
|
config.assets.digest = false
|
||||||
|
|
||||||
config.assets.debug = true
|
config.assets.debug = false
|
||||||
|
|
||||||
# Raise an error on page load if there are pending migrations
|
# Raise an error on page load if there are pending migrations
|
||||||
config.active_record.migration_error = :page_load
|
config.active_record.migration_error = :page_load
|
||||||
|
@ -32,6 +32,7 @@ class DiscourseIIFE < Sprockets::Processor
|
|||||||
.sub("/app/assets/javascripts", "")
|
.sub("/app/assets/javascripts", "")
|
||||||
.sub("/test/javascripts", "")
|
.sub("/test/javascripts", "")
|
||||||
res << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['/assets#{req_path}'] = #{data.to_json};\n"
|
res << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['/assets#{req_path}'] = #{data.to_json};\n"
|
||||||
|
res << "\n//@ sourceURL=/#{context.logical_path}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
res
|
res
|
||||||
|
@ -127,6 +127,7 @@ module Tilt
|
|||||||
req_path = "/assets/#{scope.logical_path}.#{extension}"
|
req_path = "/assets/#{scope.logical_path}.#{extension}"
|
||||||
|
|
||||||
@output << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['#{req_path}'] = #{data.to_json};\n"
|
@output << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['#{req_path}'] = #{data.to_json};\n"
|
||||||
|
@output << "\n//@ sourceURL=/#{scope.logical_path}\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
@output
|
@output
|
||||||
|
Reference in New Issue
Block a user