REFACTOR: Split off raw handlebars helpers from compiler

This allows us to compile without Ember being present
This commit is contained in:
Robin Ward
2019-11-01 11:01:16 -04:00
parent 4e07f725c6
commit 785ebb674d
5 changed files with 73 additions and 87 deletions

View File

@ -18,19 +18,19 @@ class Barber::Precompiler
# very hacky but lets us use ES6. I'm ashamed of this code -RW
transpiled = transpiled[0...transpiled.index('export ')]
@precompiler = StringIO.new <<END
var __RawHandlebars;
(function() {
#{transpiled};
__RawHandlebars = RawHandlebars;
})();
@precompiler = StringIO.new <<~END
var __RawHandlebars;
(function() {
#{transpiled};
__RawHandlebars = RawHandlebars;
})();
Barber = {
precompile: function(string) {
return __RawHandlebars.precompile(string, false).toString();
}
};
END
Barber = {
precompile: function(string) {
return __RawHandlebars.precompile(string, false).toString();
}
};
END
end
@precompiler