mirror of
https://github.com/discourse/discourse.git
synced 2025-03-25 05:55:35 +08:00
Generate compatibility layer for Components too
This commit is contained in:
parent
aa9e89b6c8
commit
275fa02082
@ -68,9 +68,10 @@ module Tilt
|
|||||||
# For backwards compatibility with plugins, for now export the Global format too.
|
# 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
|
# We should eventually have an upgrade system for plugins to use ES6 or some other
|
||||||
# resolve based API.
|
# resolve based API.
|
||||||
if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/controllers\/(.*)/
|
if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/(controllers|components|views)\/(.*)/
|
||||||
class_name = Regexp.last_match[1].gsub(/[\-\/]/, '_').classify
|
type = Regexp.last_match[1]
|
||||||
@output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default"
|
class_name = Regexp.last_match[2].gsub(/[\-\/]/, '_').classify
|
||||||
|
@output << "\n\nDiscourse.#{class_name}#{type.classify} = require('#{scope.logical_path}').default"
|
||||||
end
|
end
|
||||||
|
|
||||||
@output
|
@output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user