-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathindex.js
54 lines (44 loc) · 1.34 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
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
'use strict';
var path = require('path');
module.exports = {
name: require('./package').name,
options: {
babel: {
plugins: [
require.resolve('ember-concurrency/async-arrow-task-transform'),
],
},
},
included(app) {
this._super.included.apply(this, arguments);
this.includePublic(app);
this.setupSVGO(app);
},
/**
* Finds the public folder and includes it into the ember-inline-svg addon.
*/
includePublic(app) {
const publicPath = path.resolve('public');
const dummyPublicPath = path.resolve('tests/dummy/public');
app.options.svg = app.options.svg || {};
app.options.svg.paths = app.options.svg.paths || [];
app.options.svg.paths.push(publicPath);
if (this.isDevelopingAddon()) app.options.svg.paths.push(dummyPublicPath);
this.addons.forEach((addon) => {
if (addon.name === 'ember-inline-svg') addon.included(app);
});
},
/**
* Adjust SVG optimizer defaults (used by ember-inline-svg).
*/
setupSVGO(app) {
app.options.svg = app.options.svg || {};
app.options.svg.optimize = app.options.svg.optimize || {};
app.options.svg.optimize.plugins = app.options.svg.optimize.plugins || [];
app.options.svg.optimize.plugins.push({ removeViewBox: false });
},
};