Code Monkey home page Code Monkey logo

coc-tailwindcss's Introduction

Tailwind CSS IntelliSense

fork from vscode-tailwindcss v0.2.0

Tailwind CSS class name completion for coc.nvim

image

Install

CocInstall coc-tailwindcss

or with vim-plug, in your .vimrc/init.vim inside the plug#begin/end block:

Plug 'iamcco/coc-tailwindcss',  {'do': 'yarn install --frozen-lockfile && yarn run build'}

Create tailwindCSS configuration in your project

this extension need the configuration exists in your project

tailwind init

Settings

  • tailwindCSS.trace.server Trace level of tailwindCSS language server, default: off

  • tailwindCSS.emmetCompletions Enable class name completions for Emmet-style syntax, default: false

  • tailwindCSS.cssLanguages css languages completion support, default:

    [ "css", "less", "postcss", "sass", "scss", "stylus", "vue" ]
  • tailwindCSS.jsLanguages javascript languages completion support, default:

    [ "javascript", "javascriptreact", "reason", "typescriptreact" ]
  • tailwindCSS.htmlLanguages html languages completion support, default:

    [ "blade", "edge", "eelixir", "ejs", "elixir", "elm", "erb", "eruby", "haml", "handlebars", "htmldjango", "html", "HTML (EEx)", "HTML (Eex)", "html.twig", "jade", "leaf", "markdown", "njk", "nunjucks", "php", "razor", "slim", "svelte", "twig", "vue" ]

Features

Tailwind CSS IntelliSense uses your projects Tailwind installation and configuration to provide suggestions as you type.

HTML (including Vue, JSX, PHP etc.)

  • Class name suggestions
    • Suggestions include color previews where applicable, for example for text and background colors
    • They also include a preview of the actual CSS for that class name
  • CSS preview when hovering over class names

CSS

  • Suggestions when using @apply and config()
  • Suggestions when using the @screen directive
  • Improves syntax highlighting when using @apply and config()

Headwind

fork from headwind

Headwind is an opinionated Tailwind CSS class sorter for coc.nvim. It enforces consistent ordering of classes by parsing your code and reprinting class tags to follow a given order.

Headwind runs on save, will remove duplicate classes and can even sort entire workspaces.

Usage

You can trigger Headwind by:

Commands

  • tailwindCSS.headwind.sortTailwindClasses Sort Tailwind CSS Classes
  • tailwindCSS.headwind.sortTailwindClassesOnWorkspace Sort Tailwind CSS Classes on Entire Workspace

Headwind can sort individual files by running tailwindCSS.headwind.sortTailwindClasses via the Command Palette. Workspaces can also be sorted by running tailwindCSS.headwind.sortTailwindClassesOnWorkspace.

Any breakpoints or unknown classes will be moved to the end of the class list, whilst duplicate classes will be removed.

Customisation

Headwind ships with a default class order (located in package.json). You can edit this (and other settings) to your liking on the extension settings page.

tailwindCSS.headwind.classRegex:

An object with language IDs as keys and their values determining the regex to search for Tailwind CSS classes. The default is located in package.json but this can be customized to suit your needs.

There can be multiple capturing groups, that should only contain a string with Tailwind CSS classes (without any apostrophies etc.). If a new group, which doesn't contain the class string, is created, ensure that it is non-capturing by using (?:).

Example from package.json:

"tailwindCSS.headwind.classRegex": {
		"html": "\\bclass\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\']",
		"javascriptreact": "(?:\\bclassName\\s*=\\s*[\\\"\\']([_a-zA-Z0-9\\s\\-\\:\\/]+)[\\\"\\'])|(?:\\btw\\s*`([_a-zA-Z0-9\\s\\-\\:\\/]*)`)"
}

tailwindCSS.headwind.sortTailwindClasses:

An array that determines Headwind's default sort order.

tailwindCSS.headwind.removeDuplicates:

Headwind will remove duplicate class names by default. This can be toggled on or off.

"tailwindCSS.headwind.removeDuplicates": false

tailwindCSS.headwind.runOnSave:

Headwind will run on save by default (if a tailwind.config.js file is present within your working directory). This can be toggled on or off.

"tailwindCSS.headwind.runOnSave": false

coc-tailwindcss's People

Contributors

adelarsq avatar dependabot[bot] avatar dkuku avatar dylanirlbeck avatar esetnik avatar iamcco avatar iheanyi avatar jc00ke avatar mirsella avatar snyk-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.