This repository was archived by the owner on Feb 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
43 lines (33 loc) · 1.41 KB
/
index.js
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
'use strict';
const path = require('path');
module.exports = {
name: 'ember-milligram',
included() {
this._super.included.apply(this, arguments);
let app;
// Use the `_findHost()` method if available (in ember-cli >= 2.7.0)
if (typeof this._findHost === 'function') {
app = this._findHost();
} else {
// Otherwise, we'll use the copied `_findHost()` implementation borrowed from ember-cli
// https://github.com/ember-cli/ember-cli/blob/v2.15.1/lib/models/addon.js#L614-L625
let current = this;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
}
this.app = app;
// https://ember-cli.com/extending/#broccoli-build-options-for-in-repo-addons
app.options = app.options || {};
app.options.sassOptions = app.options.sassOptions || {};
app.options.sassOptions.includePaths = app.options.sassOptions.includePaths || [];
// resolve the filename location of the dist `milligram.css`
// https://nodejs.org/api/modules.html#modules_require_resolve
let milligramCssFilePath = require.resolve('milligram');
// return the milligram dist directory path
// https://nodejs.org/api/path.html#path_path_dirname_path
let milligramCssDir = path.dirname(milligramCssFilePath);
// Include the compiled dist `.css` directory
app.options.sassOptions.includePaths.push(milligramCssDir);
}
};