Skip to content

Commit 9442525

Browse files
committed
Fixes assets discovery
1 parent 9b9ad3b commit 9442525

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

addon/create-web-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function _appendStyles(dest, styles) {
1515
}
1616

1717
class ApplicationContainer extends HTMLElement {
18-
#styles = (config.webComponentsAssets || {}).styles
18+
#styles = (config.webComponentsAssets || {}).css
1919
#shadowRoot
2020
#application
2121

index.js

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,37 @@
33
module.exports = {
44
name: require('./package').name,
55
config(env, config) {
6-
if (!this.app) {
6+
let app = this._findHost()
7+
if (!app) {
78
return;
89
}
9-
this.app.options.storeConfigInMeta = false;
10-
this.app.options.autoRun = false;
10+
app.options.storeConfigInMeta = false;
11+
app.options.autoRun = false;
12+
13+
let assets = this._findAssets(app.options.outputPaths)
1114
return {
12-
webComponentsAssets : {
13-
styles: this._styles
14-
}
15+
webComponentsAssets : assets
16+
1517
}
1618
},
1719
included(addon) {
18-
let { options } = addon
19-
let styles = {
20-
// Why tho?? The structure of options.outputPaths is weird and inconsistent
21-
...options.outputPaths.app.css,
22-
vendor: options.outputPaths.vendor.css
20+
this.app.import('vendor/register-components.js')
21+
},
22+
_findAssets(paths) {
23+
let {
24+
app: {
25+
css: appCss,
26+
js: appJs
27+
},
28+
vendor: {
29+
css: vendorCss,
30+
js: vendorJs
31+
}
32+
} = paths
33+
return {
34+
css: { ...appCss, vendor: vendorCss },
35+
js: { app: appJs, vendor: vendorJs }
2336
}
2437

25-
this._styles = styles
26-
27-
this.app.import('vendor/register-components.js')
2838
}
2939
};

0 commit comments

Comments
 (0)