Created
October 26, 2018 18:07
-
-
Save WillsonSmith/998305a958eb68b7526169c585ff6808 to your computer and use it in GitHub Desktop.
template for a webview in scriptable.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const styles = ` | |
html { | |
font-family: -apple-system; | |
font-size: 10px; | |
} | |
body { | |
font-size: 1.6rem; | |
} | |
h1 { | |
font-size: 2.8rem; | |
} | |
` | |
function Title(title, level) { | |
return `<h${level || 2}>${title}</h2>` | |
} | |
function p(text) { | |
return `<p>${text}</p>` | |
} | |
WebView.loadHTML(` | |
<html> | |
<head> | |
<title></title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
${styles} | |
</style> | |
</head> | |
<body> | |
${Title("My page", 1)} | |
${p(` | |
This is my webview rendered from scriptable. | |
`)} | |
<script type="text/javascript"> | |
</script> | |
</body> | |
</html> | |
`); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment