Skip to content

Commit

Permalink
feat(pack): add tailwindcss pack
Browse files Browse the repository at this point in the history
  • Loading branch information
taskylizard authored and A-Lamia committed Mar 19, 2023
1 parent f91eb2f commit 659d949
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lua/astrocommunity/pack/tailwindcss/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# tailwindcss Language Pack

This plugin pack does the following:

- Adds `css` Treesitter parser
- Adds `tailwindcss` and `cssls` language servers
- Adds `prettier` and `rustywind` formatters
- Adds `roobert/tailwindcss-colorizer-cmp.nvim` to cmp completion sources
46 changes: 46 additions & 0 deletions lua/astrocommunity/pack/tailwindcss/tailwindcss.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
local utils = require "astrocommunity.utils"
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table or string "all".
if not opts.ensure_installed then
opts.ensure_installed = {}
elseif opts.ensure_installed == "all" then
return
end
-- Add the required file types to opts.ensure_installed.
utils.list_insert_unique(opts.ensure_installed, "css")
end,
},
{
"williamboman/mason-lspconfig.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table.
if not opts.ensure_installed then opts.ensure_installed = {} end
-- Add tsserver to opts.ensure_installed using vim.list_extend.
utils.list_insert_unique(opts.ensure_installed, { "tailwindcss", "cssls" })
end,
},
{
"jay-babu/mason-null-ls.nvim",
opts = function(_, opts)
-- Ensure that opts.ensure_installed exists and is a table
if not opts.ensure_installed then opts.ensure_installed = {} end
utils.list_insert_unique(opts.ensure_installed, { "prettier", "rustywind" })
end,
},
{
"hrsh7th/nvim-cmp",
dependencies = {
{ "roobert/tailwindcss-colorizer-cmp.nvim", config = true },
},
opts = function(_, opts)
local format_kinds = opts.formatting.format
opts.formatting.format = function(entry, item)
format_kinds(entry, item)
return require("tailwindcss-colorizer-cmp").formatter(entry, item)
end
end,
},
}

0 comments on commit 659d949

Please sign in to comment.