Skip to content

Instantly share code, notes, and snippets.

View sastan's full-sized avatar

Sascha Tandel sastan

View GitHub Profile
@sastan
sastan / README.md
Last active April 22, 2021 15:09
custom twind bundle
npm install

For no module script:

npm run bundle:iife 
@sastan
sastan / $layout.svelte
Last active January 15, 2023 00:15
sveltekit + urql (extended version)
<script context="module">
import { get, readable } from 'svelte/store'
import { createClient, operationStore } from '@urql/svelte'
import { browser, dev } from '$app/env'
/**
* @type {import('@sveltejs/kit').Load}
*/
@sastan
sastan / $layout.svelte
Created April 14, 2021 20:56
sveltekit + urql (minimal version)
<script context="module">
import { get, readable } from 'svelte/store'
import { createClient, operationStore } from '@urql/svelte'
import { browser, dev } from '$app/env'
/**
* @type {import('@sveltejs/kit').Load}
*/
@sastan
sastan / analyze.ts
Last active March 8, 2021 15:24
Typed Twind Plugins
import * as ts from 'typescript'
import * as fs from 'fs'
import * as path from 'path'
const { config = {} } = ts.readConfigFile(path.resolve(process.cwd(), 'tsconfig.json'), (file) =>
fs.readFileSync(file, 'utf-8'),
)
generateDocumentation([path.resolve(__dirname, 'index.ts')], config)
@sastan
sastan / tailwind-to-css.js
Last active October 3, 2023 16:10
Extract CSS Object from Tailwind classes
import { create } from 'https://cdn.skypack.dev/twind'
const { tw: TW } = create({ preflight: false })
const tw = (...tokens) => {
let styles
TW(({ css }) => {
styles = css(...tokens)
styles._ = undefined
return ''