Skip to content

Commit

Permalink
Fix attach static sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
Timofey Dergachev committed Jul 4, 2017
1 parent 894312f commit b605650
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions addon/stylesheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export default class StyleSheet {
this.options = options || {};
}

createStaticSheetAndAttach(name) {
createStaticSheet(name) {
if (this.staticSheet) {
return;
}

const options = copy(this.options);

if (!options.meta) {
Expand All @@ -29,11 +33,11 @@ export default class StyleSheet {
this.styles,
options
);
}

if (!isEmpty(this.staticSheet.classes)) {
this.staticSheet.attach();
this.refs++;
}
attachStaticSheet() {
this.staticSheet.attach();
this.refs++;
}

createDynamicSheetAndAttach(id, name) {
Expand Down Expand Up @@ -84,8 +88,10 @@ export default class StyleSheet {
}

attach(id, name) {
if (!this.staticSheet) {
this.createStaticSheetAndAttach(name);
this.createStaticSheet(name);

if (!isEmpty(this.staticSheet.classes)) {
this.attachStaticSheet();
}

this.createDynamicSheetAndAttach(id, name);
Expand Down

0 comments on commit b605650

Please sign in to comment.