Before this change, we used a single classRegex string for all possible file types.
This change allows more configurability in the form of different classRegexs for different languages. Thanks to this PR using Headwind in a bigger project will be more useful.
Headwind detects the documents languageId and uses it's classRegex config
for finding the class strings.
The classRegex config now requires that capture groups contain a class string
like class1 class2 class3 instead of one containing a class string with
apostrophies and one without. There can be multiple capture groups which can be used
for example in React applications where we have both className attributes and
CSS-in-JS tw tagged templates.
In this PR when there's no config for some language Headwind just won't
parse the file. Should this be the default behaviour? Because it can be easily changed to use a default html config or show a message.
Before this change, we used a single
classRegex
string for all possible file types. This change allows more configurability in the form of differentclassRegex
s for different languages. Thanks to this PR using Headwind in a bigger project will be more useful.Headwind detects the documents
languageId
and uses it'sclassRegex
config for finding theclass
strings.The
classRegex
config now requires that capture groups contain aclass
string likeclass1 class2 class3
instead of one containing aclass
string with apostrophies and one without. There can be multiple capture groups which can be used for example in React applications where we have bothclassName
attributes and CSS-in-JStw
tagged templates.In this PR when there's no config for some language Headwind just won't parse the file. Should this be the default behaviour? Because it can be easily changed to use a default
html
config or show a message.