Skip to content

Commit

Permalink
Merge pull request #5123 from duykhoa/maintenace/refactor-style-gather
Browse files Browse the repository at this point in the history
Simplify condition checking in stylesFromModule function
  • Loading branch information
TimvdLippe authored Feb 19, 2018
2 parents 5c02730 + e690382 commit 10aded4
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 10aded4

Please sign in to comment.