diff --git a/README.md b/README.md index 95913db..4091cb2 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,23 @@ CSS can be accessed via `/css/main.css`: ``` +Or written inline using the `css` template tag: + +```tsx +import { css } from "hype" + +export default () => ( +
+ {css` + * { + color: red; + } + `} +

Hello

+
+) +``` + ### css reset `hype` includes a css reset for your convenience: @@ -111,6 +128,25 @@ import { initAbout } from "./about" import utils from "./shared/utils" ``` +Or written inline as transpiled typescript using the `js` template tag: + +```tsx +import { js } from "hype" + +export default () => ( +
+ {js` + window.onload = () => alert(welcomeMsg(Date.now())) + + function welcomeMsg(time: number): string { + return "Welcome to my website!" + } + `} +

Hello!

+
+) +``` + ### pub Anything in `pub/` is served as-is. Simple stuff. @@ -119,19 +155,22 @@ Anything in `pub/` is served as-is. Simple stuff. `hype` includes helpful utils for your webapp: -- capitalize -- darkenColor -- isDarkMode -- lightenColor -- rand -- randIndex -- randItem -- randomId -- randRange -- redirectBack -- transpile -- unique -- weightedRand +- `capitalize(str: string): string` - Capitalizes a word +- `css` Template Tag - Lets you inline CSS in your TSX. Returns a `