-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathindex.js
More file actions
50 lines (43 loc) · 1.54 KB
/
index.js
File metadata and controls
50 lines (43 loc) · 1.54 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
42
43
44
45
46
47
48
49
50
'use strict';
var path = require('path');
var fs = require('fs');
var ADDON_NAME = "ember-cli-font-awesome";
function EmberCliFontAwesome(project) {
this.project = project;
this.name = ADDON_NAME;
}
function unwatchedTree(dir) {
return {
read: function() {
return dir;
},
cleanup: function() {
}
};
}
EmberCliFontAwesome.prototype.treeFor = function treeFor(name) {
var treePath = path.join("node_modules", ADDON_NAME);
if (name === "vendor") {
// Map 'node_modules' to 'vendor', so that we can import Font Awesome assets later.
treePath = path.join(treePath, "node_modules");
} else {
// otherwise just append '-add-on';
treePath = path.join(treePath, name + "-addon");
}
if (fs.existsSync(treePath)) {
return unwatchedTree(treePath);
}
};
EmberCliFontAwesome.prototype.included = function included(app) {
this.app = app;
var options = this.app.options.emberCliFontAwesome || { includeFontAwesomeAssets: true };
if (options.includeFontAwesomeAssets) {
app.import("vendor/font-awesome/css/font-awesome.css");
app.import("vendor/font-awesome/fonts/fontawesome-webfont.eot", { destDir: "fonts" });
app.import("vendor/font-awesome/fonts/fontawesome-webfont.svg", { destDir: "fonts" });
app.import("vendor/font-awesome/fonts/fontawesome-webfont.ttf", { destDir: "fonts" });
app.import("vendor/font-awesome/fonts/fontawesome-webfont.woff", { destDir: "fonts" });
app.import("vendor/font-awesome/fonts/FontAwesome.otf", { destDir: "fonts" });
}
};
module.exports = EmberCliFontAwesome;