mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Plugin Backwards compatibility layer for ES6
This commit is contained in:
parent
e68e97d986
commit
092f7510b4
1 changed files with 9 additions and 0 deletions
|
@ -64,6 +64,15 @@ module Tilt
|
|||
klass.protect do
|
||||
@output = klass.v8.eval(generate_source(scope))
|
||||
end
|
||||
|
||||
# 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.
|
||||
if scope.logical_path =~ /discourse\/controllers\/(.*)/
|
||||
class_name = Regexp.last_match[1].gsub(/[\-\/]/, '_').classify
|
||||
@output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default"
|
||||
end
|
||||
|
||||
@output
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue