Skip to content

Commit

Permalink
Start
Browse files Browse the repository at this point in the history
  • Loading branch information
billhorsman committed Dec 15, 2020
1 parent 0033e71 commit 061276e
Show file tree
Hide file tree
Showing 7 changed files with 647 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# The Tito Widget

This is an experiment to see if we can use Netlify's [Deploy to Netlify](https://docs.netlify.com/site-deploys/create-deploys/#deploy-to-netlify-button) button to make it really easy to setup a website using the [Tito Widget](https://help.tito.io/en/articles/2003029-widget).
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[template.environment]
TITLE = "Awesome Conf"
EVENT = "demo/awesomeconf"
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "netlify-tito-widget",
"version": "0.0.1",
"description": "Deploy the Tito widget to Netlify",
"main": "index.js",
"scripts": {
"generate": "node ./scripts/generate",
"dev": "serve ./dist"
},
"keywords": [],
"author": "Team Tito",
"dependencies": {},
"devDependencies": {
"fs-extra": "^9.0.1",
"serve": "^11.3.2"
}
}
13 changes: 13 additions & 0 deletions scripts/generate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const fse = require("fs-extra");

const data = fse.readFileSync("src/index.html");
const slug = process.env.EVENT || "demo/awesomeconf";
const widget = `<tito-widget event="${slug}"></tito-widget>`;
const title = process.env.TITLE || "Tito Widget";
const html = data
.toString()
.replace(/{{ WIDGET }}/g, widget)
.replace(/{{ TITLE }}/g, title)
.replace(/{{ EVENT }}/g, slug);
fse.mkdirsSync("dist");
fse.writeFileSync("dist/index.html", html);
32 changes: 32 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title>{{ TITLE }}</title>
<link rel="stylesheet" type="text/css" href="https://css.tito.io/v1.1" />
<script src="https://js.tito.io/v1" async></script>
<link
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
rel="stylesheet"
/>
<script type="text/javascript">
TitoDevelopmentMode = true;
</script>
</head>
<body class="flex flex-col h-screen justify-between">
<header class="p-10">
<h1 class="font-bold text-3xl">{{ TITLE }}</h1>
</header>
<main class="p-10">
{{ WIDGET }}
</main>
<footer class="p-5 bg-gray-100 text-right">
Hosted by
<a
href="https://ti.to/{{ EVENT }}"
class="text-blue-500 underline hover:text-blue-700"
>Tito</a
>
</footer>
</body>
</html>
Loading

0 comments on commit 061276e

Please sign in to comment.