在原子外壳中使用loadHtml而不是loadUrl? (尝试使用玉石) [英] loadHtml instead of loadUrl in atom-shell? (trying to use jade)
本文介绍了在原子外壳中使用loadHtml而不是loadUrl? (尝试使用玉石)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
atom-shell仅具有一种从URL加载HTML的方法
atom-shell only has a method to load HTML from a URL
window.loadUrl('file://...')
但我想使用Jade
var html = jade.renderFile('file://...');
是否可以使用编译后的 html
在原子外壳窗口
中?像 loadHtml(html)
一样?
Is there a way to use the compiled html
in atom-shell window
? Something like loadHtml(html)
?
我想我可以运行一个提供编译的html的快速服务器,但是那样
I suppose I could run an express server that serves compiled html but that would be rather inefficient..
推荐答案
如果是Mac,则:
/usr/bin/open -a "/Applications/Google Chrome.app" --args 'data:text/html,<html><body><h1>title</h1><p>text</p></body></html>'
有关URI的详细信息
https://developer.mozilla.org/zh-CN/docs/Web/HTTP/data_URIs
这篇关于在原子外壳中使用loadHtml而不是loadUrl? (尝试使用玉石)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文