-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathindex.js
More file actions
41 lines (32 loc) · 1.12 KB
/
index.js
File metadata and controls
41 lines (32 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* jshint node: true */
'use strict';
var Filter = require('broccoli-filter');
function TemplateCompiler (inputTree, options) {
if (!(this instanceof TemplateCompiler)) {
return new TemplateCompiler(inputTree, options);
}
Filter.call(this, inputTree, options); // this._super()
this.options = options || {};
this.inputTree = inputTree;
this.compile = this.options.emblemCompiler || require('emblem').default.compile;
}
TemplateCompiler.prototype = Object.create(Filter.prototype);
TemplateCompiler.prototype.constructor = TemplateCompiler;
TemplateCompiler.prototype.extensions = ['embl', 'emblem'];
TemplateCompiler.prototype.targetExtension = 'hbs';
TemplateCompiler.prototype.processString = function (string, relativePath) {
console.log('processing template: '+string);
return this.compile(string);
}
module.exports = {
name: 'ember-cli-emblem-hbs-printer',
included: function(app){
this.app = app;
var compiler = {
toTree: function(tree, inputPath, outputPath) {
return TemplateCompiler(tree);
}
};
this.app.registry.add('template', compiler, ['embl', 'emblem']);
}
};