Skip to content

Instantly share code, notes, and snippets.

@eduardolat
Created December 15, 2023 05:41
Show Gist options
  • Save eduardolat/438a1de077ccac6b9792153e708c1824 to your computer and use it in GitHub Desktop.
Save eduardolat/438a1de077ccac6b9792153e708c1824 to your computer and use it in GitHub Desktop.
Regex for TailwindCSS + Gomponents
/** @type {import('tailwindcss').Config} */
module.exports = {
// Change this to your project source folder
content: ['./web/**/*.go'],
plugins: [],
theme: {
extend: {},
}
}
{
// Tailwind CSS + Gomponents
// It can handle single and multiple lines inside the matches
// It can handle double quotes (") and backticks (`)
"tailwindCSS.includeLanguages": {
"go": "go",
},
"tailwindCSS.experimental.classRegex": [
["Class\\(([^)]*)\\)", "[\"`]([^\"`]*)[\"`]"], // Class("...") or Class(`...`)
["Classes\\(([^)]*)\\)", "[\"`]([^\"`]*)[\"`]"], // Classes("...") or Classes(`...`)
["Class\\{([^)]*)\\}", "[\"`]([^\"`]*)[\"`]"], // Class{"..."} or Class{`...`}
["Classes\\{([^)]*)\\}", "[\"`]([^\"`]*)[\"`]"], // Classes{"..."} or Classes{`...`}
["Class:\\s*[\"`]([^\"`]*)[\"`]"], // Class: "..." or Class: `...`
["Classes:\\s*[\"`]([^\"`]*)[\"`]"], // Classes: "..." or Classes: `...`
],
}
@markuswustenberg
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment