Skip to content

Instantly share code, notes, and snippets.

@sastan
Last active April 22, 2021 15:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sastan/c79d341b4bd2d1ec2096c437810b4f50 to your computer and use it in GitHub Desktop.
Save sastan/c79d341b4bd2d1ec2096c437810b4f50 to your computer and use it in GitHub Desktop.
custom twind bundle
npm install

For no module script:

npm run bundle:iife 
<script defer src="dist/twind.js"></script>

For module script:

npm run bundle:module 
<script type="module" src="dist/twind.esm.js"></script>
import { setup, observe } from 'twind/observe'
import * as colors from 'twind/colors'
setup({
"mode": "silent",
"theme": {
"fontFamily": {
"sans": ["Roboto", "sans-serif"]
},
"extend": {
"colors": {
"gray": colors.trueGray
}
}
}
})
observe(document.documentElement)
{
"name": "twind-setup-observe",
"main": "index.js",
"scripts": {
"bundle:module": "esbuild index.js --outfile=dist/twind.esm.js --bundle --minify --format=esm --platform=browser --target=es2017",
"bundle:iife": "esbuild index.js --outfile=dist/twind.js --bundle --minify --format=iife --platform=browser --target=es2017"
},
"dependencies": {
"twind": "^0.16.12"
},
"devDependencies": {
"esbuild": "^0.11.12"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment