├── .gitignore ├── .vscode └── extensions.json ├── README.md ├── package.json ├── postcss.config.js ├── public ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon.ico ├── index.html └── tailwind.css ├── sandbox.config.json └── tailwind.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | public/build 3 | yarn.lock 4 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["bradlc.vscode-tailwindcss"] 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tailwind CSS Playground 2 | 3 | A simple starter project for playing around with Tailwind in a proper PostCSS environment. 4 | 5 | To get started: 6 | 7 | 1. Clone the repository: 8 | 9 | ```bash 10 | git clone https://github.com/tailwindcss/playground.git tailwindcss-playground 11 | 12 | cd tailwindcss-playground 13 | ``` 14 | 15 | 2. Install the dependencies: 16 | 17 | ```bash 18 | # Using npm 19 | npm install 20 | 21 | # Using Yarn 22 | yarn 23 | ``` 24 | 25 | 3. Start the development server: 26 | 27 | ```bash 28 | # Using npm 29 | npm run serve 30 | 31 | # Using Yarn 32 | yarn run serve 33 | ``` 34 | 35 | Now you should be able to see the project running at localhost:8080. 36 | 37 | 4. Open `public/index.html` in your editor and start experimenting! 38 | 39 | ## Building for production 40 | 41 | Even though this isn't necessarily a starter kit for a proper project, we've included an example of setting up both [Purgecss](https://www.purgecss.com/) and [cssnano](https://cssnano.co/) to optimize your CSS for production. 42 | 43 | To build an optimized version of your CSS, simply run: 44 | 45 | ```bash 46 | # Using npm 47 | npm run production 48 | 49 | # Using Yarn 50 | yarn run production 51 | ``` 52 | 53 | After that's done, check out `./public/build/tailwind.css` to see the optimized output. 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "serve": "cross-env NODE_ENV=development concurrently \"postcss public/tailwind.css -o public/build/tailwind.css --watch\" \"live-server ./public\"", 4 | "development": "cross-env NODE_ENV=development postcss public/tailwind.css -o public/build/tailwind.css", 5 | "production": "cross-env NODE_ENV=production postcss public/tailwind.css -o public/build/tailwind.css", 6 | "start": "npm run serve" 7 | }, 8 | "dependencies": { 9 | "@tailwindcss/ui": "^0.4.0", 10 | "autoprefixer": "^9.5.1", 11 | "tailwindcss": "^1.5.2" 12 | }, 13 | "devDependencies": { 14 | "@fullhuman/postcss-purgecss": "^1.2.0", 15 | "concurrently": "^4.1.0", 16 | "cross-env": "^5.2.0", 17 | "cssnano": "^4.1.10", 18 | "live-server": "^1.2.1", 19 | "postcss-cli": "^6.1.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require('tailwindcss'), require('autoprefixer')], 3 | } 4 | -------------------------------------------------------------------------------- /public/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamwathan/tailwind-animation-playground/f1f14b3daa46ca1d5d9c3d43d962f8ddc7a8e0db/public/favicon-16x16.png -------------------------------------------------------------------------------- /public/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamwathan/tailwind-animation-playground/f1f14b3daa46ca1d5d9c3d43d962f8ddc7a8e0db/public/favicon-32x32.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamwathan/tailwind-animation-playground/f1f14b3daa46ca1d5d9c3d43d962f8ddc7a8e0db/public/favicon.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Tailwind CSS Animation Demo 10 | 11 | 12 |
13 |
14 |
15 |

16 | Spin 17 |

18 | 19 | 45 | 46 |
47 |
48 |

49 | Ping 50 |

51 | 52 | 58 |
59 | 60 | 61 | 62 | 63 |
64 |
65 |
66 |
67 |

68 | Bounce 69 |

70 |
71 | 80 | 81 | 82 |
83 |
84 |
85 |
86 |
87 |

88 | Fade 89 |

90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 | 108 | 109 | -------------------------------------------------------------------------------- /public/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | 4 | @tailwind utilities; 5 | 6 | @tailwind screens; 7 | -------------------------------------------------------------------------------- /sandbox.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "node" 3 | } 4 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | const plugin = require('tailwindcss/plugin') 2 | 3 | module.exports = { 4 | purge: ['./public/index.html'], 5 | theme: { 6 | extend: {}, 7 | }, 8 | variants: {}, 9 | plugins: [ 10 | require('@tailwindcss/ui'), 11 | plugin( 12 | function ({ addBase, addUtilities, theme, variants, e }) { 13 | const keyframesConfig = theme('keyframes') 14 | const keyframesStyles = Object.fromEntries( 15 | Object.entries(keyframesConfig).map(([name, keyframes]) => { 16 | return [`@keyframes ${name}`, keyframes] 17 | }) 18 | ) 19 | addBase(keyframesStyles) 20 | 21 | const animationConfig = theme('animation') 22 | const utilities = Object.fromEntries( 23 | Object.entries(animationConfig).map(([suffix, animation]) => { 24 | return [ 25 | `.${e(`animate-${suffix}`)}`, 26 | { 27 | animation, 28 | }, 29 | ] 30 | }) 31 | ) 32 | addUtilities(utilities, variants('animation')) 33 | }, 34 | { 35 | theme: { 36 | animation: { 37 | spin: 'spin 1s linear infinite', 38 | ping: 'ping 1s cubic-bezier(0, 0, 0.2, 1) infinite', 39 | fade: 'fade 2s cubic-bezier(0.4, 0, 0.6, 1) infinite', 40 | bounce: 'bounce 1s infinite', 41 | }, 42 | keyframes: { 43 | spin: { 44 | from: { transform: 'rotate(0deg)' }, 45 | to: { transform: 'rotate(360deg)' }, 46 | }, 47 | ping: { 48 | '0%': { transform: 'scale(1)', opacity: '1' }, 49 | '75%, 100%': { transform: 'scale(2)', opacity: '0' }, 50 | }, 51 | fade: { 52 | '0%, 100%': { opacity: '1' }, 53 | '50%': { opacity: '.5' }, 54 | }, 55 | bounce: { 56 | '0%, 100%': { 57 | transform: 'translateY(-25%)', 58 | animationTimingFunction: 'cubic-bezier(0.8,0,1,1)', 59 | }, 60 | '50%': { 61 | transform: 'translateY(0)', 62 | animationTimingFunction: 'cubic-bezier(0,0,0.2,1)', 63 | }, 64 | }, 65 | }, 66 | }, 67 | } 68 | ), 69 | ], 70 | } 71 | --------------------------------------------------------------------------------