Skip to content
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

Add support for glob syntax in {css,js}_files lists #35

Closed
sisp opened this issue Nov 12, 2023 · 2 comments · Fixed by #37
Closed

Add support for glob syntax in {css,js}_files lists #35

sisp opened this issue Nov 12, 2023 · 2 comments · Fixed by #37

Comments

@sisp
Copy link

sisp commented Nov 12, 2023

I'd like to be able to list files to minify using glob syntax, which doesn't seem to be supported yet. For instance:

plugins:
  - minify:
      css_files:
        - assets/css/**/*.css

I have several CSS files, many contain page-specific styles, so the list grows with more pages. Instead of maintaining a hardcoded list of files, I'd prefer using glob syntax.

The same applies to JS files, of course.

WDYT?

@AdrianDsg
Copy link
Contributor

AdrianDsg commented Nov 20, 2023

This should be possible by iterating through file_paths in line 84 in

file_paths = [file_paths]
for file_path in file_paths:

looking for * and resolving the globs by using pathlib.Path.glob() and extending file_paths with the results.

@AdrianDsg
Copy link
Contributor

AdrianDsg commented Dec 15, 2023

I just revisited this topic again and came up with a working proposal in #37. As mentioned in the PR the code might be not as efficient and clean as possible so please feel free to share your feedback to improve the code quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants