PERF: Speed up JSHint tests by using local buffers instead of AJAX

requests.
This commit is contained in:
Robin Ward
2014-07-22 14:13:13 -04:00
parent 386b6213a5
commit 4c51258526
4 changed files with 44 additions and 6 deletions

View File

@ -65,6 +65,8 @@ module Tilt
@output = klass.v8.eval(generate_source(scope))
end
source = @output.dup
# For backwards compatibility with plugins, for now export the Global format too.
# We should eventually have an upgrade system for plugins to use ES6 or some other
# resolve based API.
@ -81,6 +83,12 @@ module Tilt
@output << "\n\nDiscourse.#{class_name}#{type.classify} = require('#{require_name}').default"
end
# Include JS code for JSHint
unless Rails.env.production?
req_path = "/assets/#{scope.logical_path}.js"
@output << "\nwindow.__jshintSrc = window.__jshintSrc || {}; window.__jshintSrc['#{req_path}'] = #{source.to_json};\n"
end
@output
end