From 275fa02082473a6fd89382d3541f3e2c6d413938 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Fri, 16 May 2014 16:39:41 -0400 Subject: [PATCH] Generate compatibility layer for Components too --- .../tilt/es6_module_transpiler_template.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb index a8ae2070d4e..c1a4cacc99e 100644 --- a/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb +++ b/lib/es6_module_transpiler/tilt/es6_module_transpiler_template.rb @@ -68,9 +68,10 @@ module Tilt # 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 ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/controllers\/(.*)/ - class_name = Regexp.last_match[1].gsub(/[\-\/]/, '_').classify - @output << "\n\nDiscourse.#{class_name}Controller = require('#{scope.logical_path}').default" + if ENV['DISCOURSE_NO_CONSTANTS'].nil? && scope.logical_path =~ /discourse\/(controllers|components|views)\/(.*)/ + type = Regexp.last_match[1] + class_name = Regexp.last_match[2].gsub(/[\-\/]/, '_').classify + @output << "\n\nDiscourse.#{class_name}#{type.classify} = require('#{scope.logical_path}').default" end @output