-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
83 lines (69 loc) · 2.16 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
const mergeTrees = require('broccoli-merge-trees');
const Funnel = require('broccoli-funnel');
const path = require('path');
const nodeSass = require('node-sass');
module.exports = {
name: require('./package').name,
// isDevelopingAddon() {
// return true;
// },
options: {
svgJar: {
sourceDirs: [
'public',
'node_modules/ember-styleguide-experimental/public',
'tests/dummy/public'
]
},
googleFonts: [
'Roboto:400,700'
],
fontawesome: {
icons: {
'free-solid-svg-icons': 'all',
'free-regular-svg-icons': 'all',
}
},
},
included(app, parentAddon) {
let target = (app || parentAddon);
target.options = target.options || {};
const defaultEmberBootStrapOptions = {
bootstrapVersion: 4,
importBootstrapFont: false,
importBootstrapCSS: false
};
target.options['ember-bootstrap'] = target.options['ember-bootstrap'] || defaultEmberBootStrapOptions;
target.options.sassOptions = target.options.sassOptions || { implementation: nodeSass };
this.checkPreprocessor();
this._super.included.apply(this, arguments);
},
treeForStyles() {
return new Funnel(this.getEmberStyleguideStylesPath(), {
destDir: 'ember-styleguide-experimental'
});
},
treeForAddonStyles(tree) {
let bootstrapTree = new Funnel(this.getBootstrapStylesPath(), {
destDir: 'ember-bootstrap'
});
return mergeTrees([bootstrapTree, tree]);
},
treeForPublic: function() {
return new Funnel(path.join(this.root, 'public'));
},
getEmberStyleguideStylesPath() {
let pkgPath = path.dirname(__filename);
return path.join(pkgPath, 'addon', 'styles');
},
getBootstrapStylesPath() {
let pkgPath = path.dirname(require.resolve(`bootstrap/package.json`));
return path.join(pkgPath, 'scss');
},
checkPreprocessor() {
if (this.app && !this.app.project.findAddonByName('ember-cli-sass')) {
this.ui.writeLine('ember-styleguide-experimental: npm package "ember-cli-sass" is missing. Consider using it to use `@import \'ember-styleguide-experimental/globals/variables\'` in your styles.');
}
}
};