Skip to content

Instantly share code, notes, and snippets.

@WillsonSmith
Created October 26, 2018 18:07
Show Gist options
  • Save WillsonSmith/998305a958eb68b7526169c585ff6808 to your computer and use it in GitHub Desktop.
Save WillsonSmith/998305a958eb68b7526169c585ff6808 to your computer and use it in GitHub Desktop.
template for a webview in scriptable.app
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