Skip to content

Commit

Permalink
Link the stylesheet instead of inserting it inline
Browse files Browse the repository at this point in the history
This prevents the style to be blocked by CSP rules

Fixes #5
  • Loading branch information
gregkare committed Oct 16, 2017
1 parent 7dba9e3 commit f07b8e1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,16 @@ Widget.prototype = {
* @private
*/
createHtmlTemplate () {
const element = document.createElement('div');
const style = document.createElement('style');
style.innerHTML = require('raw!./assets/styles.css');
const head = document.getElementsByTagName('head')[0];
const style = document.createElement('link');
style.type = 'text/css';
style.rel = 'stylesheet';
style.href = '/assets/styles.css';
head.appendChild(style);

element.id = "remotestorage-widget";
const element = document.createElement('div');
element.id = 'remotestorage-widget';
element.innerHTML = require('html!./assets/widget.html');
element.appendChild(style);

return element;
},
Expand Down

0 comments on commit f07b8e1

Please sign in to comment.