theming: send themes directly through http requests
This commit is contained in:
parent
298ac51f67
commit
63a96e1c58
4 changed files with 7 additions and 14 deletions
|
|
@ -11,6 +11,7 @@
|
|||
<link rel="preload" href="scripts.js"/>
|
||||
<link rel="preload" href="scripts.js.map"/>
|
||||
<link rel="stylesheet" href="styles.css" hot-reload/>
|
||||
<link rel="stylesheet" href="theme.css" hot-reload/>
|
||||
<link rel="stylesheet" href="fonts/font-awesome.min.css"/>
|
||||
<link rel="stylesheet" href="fonts/droid-sans.css"/>
|
||||
<script src="scripts.js"></script>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ module.exports = {
|
|||
ready: function(data,clientId) {
|
||||
ipc.send('connected')
|
||||
|
||||
if (settings.read('theme')) ipc.send('applyStyle',settings.read('theme'),clientId)
|
||||
|
||||
if (settings.read('readOnly')) {
|
||||
ipc.send('readOnly')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,12 @@ express.get('/', function(req, res){
|
|||
res.sendFile(path.resolve(__dirname + '/../browser/index.html'))
|
||||
})
|
||||
express.get('*', function(req, res){
|
||||
res.sendFile(path.resolve(__dirname + '/../browser' + req.path))
|
||||
if (req.path.indexOf('theme.css') != -1 && settings.read('theme')) {
|
||||
res.set('Content-Type', 'text/css');
|
||||
res.send(new Buffer(settings.read('theme')))
|
||||
} else {
|
||||
res.sendFile(path.resolve(__dirname + '/../browser' + req.path))
|
||||
}
|
||||
})
|
||||
|
||||
server.listen(settings.read('httpPort'))
|
||||
|
|
|
|||
|
|
@ -126,17 +126,6 @@ var callbacks = module.exports = {
|
|||
utils.createPopup(icon('warning')+' '+data.title,data.text,true)
|
||||
},
|
||||
|
||||
applyStyle: function(data){
|
||||
var style = document.createElement('style'),
|
||||
css = data.join('')
|
||||
style.innerHTML = css
|
||||
document.body.appendChild(style)
|
||||
window.GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
if (css.indexOf('--pixel-scale') != -1) {
|
||||
window.PXSCALE_RESET()
|
||||
}
|
||||
},
|
||||
|
||||
reloadCss: function(){
|
||||
var queryString = '?reload=' + new Date().getTime()
|
||||
$('link[rel="stylesheet"][hot-reload]').each(function () {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue