Skip to content

Commit

Permalink
Applying each css file to different style tags for enabling source ma…
Browse files Browse the repository at this point in the history
…p support for each file

Signed-off-by: Mehmet Baker <[email protected]>
  • Loading branch information
mehmetb committed Apr 11, 2018
1 parent f0119e5 commit 5d2f0a6
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions lib/classTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@ const stylesToInject = `

const key = (Object.keys(jcssObj)||[null]).shift();

if(key) {
let section = document.querySelector('style[data-modules="css-server"]');

if(!section) {
section = document.createElement('style');
section.setAttribute('data-modules', 'css-server');
document.head.appendChild(section);
section.innerHTML += stylesToInject;
}else if(section.innerHTML.indexOf(key) != -1) {
console.error('Selector already exist in the target style section');
}else {
section.innerHTML += stylesToInject;
}
}else{
console.error('Downloaded css object has no keys');
}

const section = document.createElement('style');
section.setAttribute('data-modules', 'css-server');
document.head.appendChild(section);
section.innerHTML += stylesToInject;

0 comments on commit 5d2f0a6

Please sign in to comment.