Skip to content

Commit

Permalink
Simplify condition checking in stylesFromModule function
Browse files Browse the repository at this point in the history
  • Loading branch information
duykhoa committed Feb 18, 2018
1 parent 5c02730 commit e690382
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/utils/style-gather.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@
*/
stylesFromModule(moduleId) {
const m = importModule(moduleId);
if (m && m._styles === undefined) {

if (!m) {
console.warn('Could not find style data in module named', moduleId);
return [];
}

if (m._styles === undefined) {
const styles = [];
// module imports: <link rel="import" type="css">
styles.push(...this._stylesFromModuleImports(m));
Expand All @@ -90,12 +96,11 @@
styles.push(...this.stylesFromTemplate(template,
/** @type {templateWithAssetPath} */(m).assetpath));
}

m._styles = styles;
}
if (!m) {
console.warn('Could not find style data in module named', moduleId);
}
return m ? m._styles : [];

return m._styles;
},

/**
Expand Down

0 comments on commit e690382

Please sign in to comment.