Skip to content

Change CLASS_NAME_PATTERN to work also for haml templates #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Change CLASS_NAME_PATTERN to work also for haml templates
  • Loading branch information
Wolfram Nikolas Müller committed Aug 23, 2021
commit fbaa4ad7f200a44034677b50680f5cf12bf5201c
4 changes: 2 additions & 2 deletions lib/tailwindcss/purger.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Tailwindcss::Purger
CLASS_NAME_PATTERN = /[:A-Za-z0-9_-]+[\.]*[\\\/:A-Za-z0-9_-]*/
CLASS_NAME_PATTERN = /((?:[:A-Za-z0-9_-]+[\\\/:A-Za-z0-9_-]*[0-3][\\.]*5)|(?:[A-Za-z0-9_-]+[\\\/:A-Za-z0-9_-]*))/

CLASS_BREAK = /(?![-_a-z0-9\\])/i # `\b` for class selectors

Expand Down Expand Up @@ -29,7 +29,7 @@ def purge(input, keeping_class_names_from_files:)
end

def extract_class_names(string)
string.scan(CLASS_NAME_PATTERN).uniq.sort!
string.scan(CLASS_NAME_PATTERN).flatten.uniq.sort!
end

def extract_class_names_from(files)
Expand Down