mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 00:20:54 +08:00
Upgrade to Babel 6
This commit is contained in:
@ -14,7 +14,7 @@ class Barber::Precompiler
|
||||
transpiled = template.babel_transpile(source)
|
||||
|
||||
# very hacky but lets us use ES6. I'm ashamed of this code -RW
|
||||
transpiled.gsub!(/^export .*$/, '')
|
||||
transpiled = transpiled[0...transpiled.index('export ')]
|
||||
|
||||
@precompiler = StringIO.new <<END
|
||||
var __RawHandlebars;
|
||||
@ -40,11 +40,11 @@ module Discourse
|
||||
module Handlebars
|
||||
module Helper
|
||||
def precompile_handlebars(string)
|
||||
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
||||
"requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
||||
end
|
||||
|
||||
def compile_handlebars(string)
|
||||
"require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
||||
"requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -55,11 +55,11 @@ class Ember::Handlebars::Template
|
||||
include Discourse::Ember::Handlebars::Helper
|
||||
|
||||
def precompile_handlebars(string, input=nil)
|
||||
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
||||
"requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
|
||||
end
|
||||
|
||||
def compile_handlebars(string, input=nil)
|
||||
"require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
||||
"requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
|
||||
end
|
||||
|
||||
def global_template_target(namespace, module_name, config)
|
||||
|
Reference in New Issue
Block a user