fix(tailwind): additional settings

Make it possible to define your own tailwind settings in opts,
and merge them with the default, additional Phoenix settings in
tailwind.lua
This commit is contained in:
Torbjørn Vatn 2024-12-28 07:00:24 +01:00
parent d0c366e4d8
commit 06b8d14575

View file

@ -24,6 +24,9 @@ return {
filetypes_include = {}, filetypes_include = {},
-- to fully override the default_config, change the below -- to fully override the default_config, change the below
-- filetypes = {} -- filetypes = {}
-- additional settings for the server, e.g:
-- tailwindCSS = { includeLanguages = { someLang = "html" } }
settings = {},
}, },
}, },
setup = { setup = {
@ -40,16 +43,17 @@ return {
return not vim.tbl_contains(opts.filetypes_exclude or {}, ft) return not vim.tbl_contains(opts.filetypes_exclude or {}, ft)
end, opts.filetypes) end, opts.filetypes)
-- Additional settings for Phoenix projects -- Add additional settings from opts
opts.settings = { opts.settings = vim.tbl_deep_extend("error", {
tailwindCSS = { tailwindCSS = {
-- Additional settings for Phoenix projects
includeLanguages = { includeLanguages = {
elixir = "html-eex", elixir = "html-eex",
eelixir = "html-eex", eelixir = "html-eex",
heex = "html-eex", heex = "html-eex",
}, },
}, },
} }, opts.settings or {})
-- Add additional filetypes -- Add additional filetypes
vim.list_extend(opts.filetypes, opts.filetypes_include or {}) vim.list_extend(opts.filetypes, opts.filetypes_include or {})