Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn committed Oct 3, 2024
1 parent 5ac9a13 commit c8a3b96
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/css_class_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const CLASS_DIRECTIVE_MATCHER = /class:([^=]+)=["'`]([^"'`]+)["'`]/g;
const CLASSES_PROP_MATCHER = /classes=["'`]([^"'`]+)["'`]/g;

// *classes = ['a', 'b']
// extracts the contents of one or more string literals in an array
const CLASSES_ARRAY_LITERAL_MATCHER = /classes\s*=\s*\[([^\]]+)\]/gi;

// *classes = 'a b'
Expand All @@ -23,6 +24,7 @@ const CLASSES_STRING_LITERAL_MATCHER = /classes\s*=\s*["'`]([^["'`]]+)["'`]/gi;
*/
export const collect_css_classes = (contents: string): string[] => {
// TODO BLOCK some false positives
// TODO BLOCK ensure no overlap in regexps
const classes: string[] = [];
const add_classes = (match: string, class_list: string) => {
classes.push(...class_list.split(/\s+/).filter(Boolean));
Expand Down

0 comments on commit c8a3b96

Please sign in to comment.