49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/gumdrop/stitch_support.rb', line 49
def export_js_code(path)
content= File.read(path)
%{
var css = #{ transpile(content, File.extname(path)).to_json },
node = null;
module.exports= {
content: css,
add: function(to){
if(node != null) return;
if(to == null) to= document.getElementsByTagName('HEAD')[0] || document.body;
node= document.createElement('style');
node.innerHTML= css;
to.appendChild(node);
return this;
},
remove: function() {
if(node != null) {
node.parentNode.removeChild(node);
node = null;
}
return this;
}
};
}
end
|