Sha256: b83238d8fceaae85d29be3638f324dbfd83f59f7ee08e176363612bd70837124
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
/** @module ember */ import require, { has } from 'require'; import precompile from './precompile'; let template; /** Uses HTMLBars `compile` function to process a string into a compiled template. This is not present in production builds. @private @method compile @param {String} templateString This is the string to be compiled by HTMLBars. @param {Object} options This is an options hash to augment the compiler options. */ export default function compile(templateString, options) { if (!template && has('@ember/-internals/glimmer')) { // tslint:disable-next-line:no-require-imports template = require('@ember/-internals/glimmer').template; } if (!template) { throw new Error('Cannot call `compile` with only the template compiler loaded. Please load `ember.debug.js` or `ember.prod.js` prior to calling `compile`.'); } let precompiledTemplateString = precompile(templateString, options); let templateJS = new Function(`return ${precompiledTemplateString}`)(); return template(templateJS); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/ember-template-compiler/lib/system/compile.js |