All Projects → ky-is → Vue Cli Plugin Tailwind

ky-is / Vue Cli Plugin Tailwind

Utility-first, modern CSS for your Vue app using TailwindCSS.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Vue Cli Plugin Tailwind

Tailwindcss Sketch Kit
💎 Sketch UI kit for Tailwind CSS
Stars: ✭ 68 (-20%)
Mutual labels:  tailwindcss
Vue Tailwind
Vue UI components with configurable classes ready for TailwindCSS
Stars: ✭ 1,183 (+1291.76%)
Mutual labels:  tailwindcss
Sonwan Ui
SonWan UI is a modular UI component library based on figma design to build your next React Web Application.
Stars: ✭ 75 (-11.76%)
Mutual labels:  tailwindcss
Dashboard
Customizable personal dashboard and startpage
Stars: ✭ 70 (-17.65%)
Mutual labels:  tailwindcss
Tailwindcss Theme Variants
Media-query- or JavaScript-based theme variants with fallback for Tailwind CSS
Stars: ✭ 73 (-14.12%)
Mutual labels:  tailwindcss
Pingcrm Svelte
🦊 Ping CRM Svelte - A demo app to illustrate how Inertia.js works with Laravel and Svelte (hosted on a heroku free dyno).
Stars: ✭ 74 (-12.94%)
Mutual labels:  tailwindcss
Alpinejs Playground
A set of ready to use Alpine.js examples with TailwindCSS
Stars: ✭ 65 (-23.53%)
Mutual labels:  tailwindcss
Tailwindcss Tables
Bootstrap styled tables for Tailwind CSS
Stars: ✭ 84 (-1.18%)
Mutual labels:  tailwindcss
Seed Quickstart Webpack
Template for web apps with Seed (Rust framework), TailwindCSS and Webpack.
Stars: ✭ 73 (-14.12%)
Mutual labels:  tailwindcss
Tailwindcss Pseudo Elements
TailwindCSS Plugin that adds variants of pseudo elements.
Stars: ✭ 81 (-4.71%)
Mutual labels:  tailwindcss
Profile Card
Tailwind CSS Starter Template - Profile Card (Single page website for your profile/links)
Stars: ✭ 69 (-18.82%)
Mutual labels:  tailwindcss
Keys
🔑 Cryptocurrency private keys
Stars: ✭ 71 (-16.47%)
Mutual labels:  tailwindcss
Stts
A starter template for Svelte, Tailwind, Typescript, and Snowpack
Stars: ✭ 78 (-8.24%)
Mutual labels:  tailwindcss
Tailwindcss Alpha
Automatic alpha variants for your Tailwind CSS colors
Stars: ✭ 68 (-20%)
Mutual labels:  tailwindcss
App Store Tailwind
Mojave App Store Rebuild with Tailwind CSS, Electron and Vue
Stars: ✭ 82 (-3.53%)
Mutual labels:  tailwindcss
Tailwind Cheatsheet
A printable one-page cheatsheet for TailwindCSS.
Stars: ✭ 67 (-21.18%)
Mutual labels:  tailwindcss
Developmint.de
Open source company page built with Nuxt.js and TailwindCSS
Stars: ✭ 74 (-12.94%)
Mutual labels:  tailwindcss
Tailwind Examples
A collection of web pages built in Tailwind CSS v0.7.4
Stars: ✭ 84 (-1.18%)
Mutual labels:  tailwindcss
Starter Kit Cool Writings
Statamic Starter Kit: Cool Writings
Stars: ✭ 84 (-1.18%)
Mutual labels:  tailwindcss
Postcss Elm Tailwind
put some tailwind in your elm
Stars: ✭ 80 (-5.88%)
Mutual labels:  tailwindcss

vue-cli-plugin-tailwind

Tailwind CSS's utility classes are minned by Purgecss, saving hundreds of kBs in production builds. postcss-preset-env polyfills modern CSS standards based on your browserslist configuration.

Install

TailwindCSS v1.0

vue add @ky-is/tailwind

When the plugin is updated, you can upgrade your configuration with:

vue invoke @ky-is/tailwind

TailwindCSS v0.x

See the tailwind-0.x branch.

Usage

Use inline classes, or @apply. For example, in src/components/HelloWorld.vue of the auto-generated cli app:

<style lang="postcss" scoped>
h1 {
  @apply text-purple-500 flex;
}
</style>

Applies scoped, browser-prefixed CSS, while PurgeCSS strips all other unused classes, including the thousands generated by Tailwind.

Configuration

postcss.config.js Plugins

  • postcss-preset-env: Defaults to stage 2, as these draft proposals are considered reasonably stable. If you want to enable handy experimental features like nested classes (a { &:hover: {...} }), change to stage: 0. You can safely delete this plugin from the list if you only write old CSS or use another preprocessor.

  • @fullhuman/postcss-purgecss: Purgecss removes all CSS classes that it can't find reference to. By default, all Vue and style files in the src folder are included. Adjust content array if you have CSS classes in other files. Add class names to the whitelist array you want to manually prevent PurgeCSS from removing if it thinks they're unused.

Whitelisting

Any CSS class that isn't used inside your .html files in public/, or by your .vue components (outside of the <style> block where they're defined) in src/ will be stripped by PurgeCSS by default, because with it doesn't have a way to know that those classes are being used out-of-the-box.

3rd-party CSS

If you're importing CSS from a 3rd-party library, you'll need to add its source files to PurgeCSS's search paths in postcss.config.js via the content array so it knows they're in use, or whitelist the imported classnames so they're never purged. As an example, vue-good-table requires importing its bundled CSS classes. There's two approaches to ensure its classes aren't purged from your production builds:

  • Add './node_modules/vue-good-table/src/**/*.vue' to the content array (so PurgeCSS sees these classes being used)

Or:

  • Add /^vgt-/ to the whitelistPatterns array (as this library prefixes its class names with .vgt-*)

Check your production build

The first time you build for production after major changes, it's always a good idea to check the output CSS to ensure PurgeCSS is configured correctly for your project. Look over the CSS files in dist/, or spin up your production build on localhost with a tool like serve:

npm install --global serve
cd yourproject
serve -s dist

Caveats

  • Don't reference class names by string concatination, as PurgeCSS cannot find them. Don't: text-${error ? 'red' : 'green'}-600. Do: error ? 'text-red-600' : 'text-green-600'.
  • By default, any class you declare that matches .*-move will be whitelisted and always included in your output CSS. This is required to support <transition-group>'s generated classnames. You can change whitelistPatterns in postcss.config.js if you don't want this behavior.
  • Any time you're using TailwindCSS and Vue, be careful not to define a <transition-group> with name="cursor", as this will generate .cursor-move which will inherit TailwindCSS's cursor class.
  • If you use any custom characters in your css classes beyond / and : (which are required for TailwindCSS), you need to add them to the default regex pattern /[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].