Skip to content

Unable to Exclude Folders From Content Globs #620

Closed
@bdkjones

Description

@bdkjones

Describe the bug
I'm filing this as a bug because the top results on Google for "purgeCSS skip folder" link to outdated advice from the PurgeCSS team. Specifically: #158 (comment)

You advise folks to use this syntax to skip a certain folder:

content: [
    '!(skippedFolder)/**/*.html',
    ...
]

The trouble is that your glob dependency removed support for ! as a negation operator in version 6.0. You currently use version 7 of glob. The ! operator is supported only in glob 5.x and below.

The way to skip folders in glob 6.x+ is to use their ignore option, which PurgeCSS does not currently expose.

To Reproduce
Simply try to use the ! operator to negate a content glob; it will fail and PurgeCSS will remove rules that it SHOULD keep because it's not scanning files appropriately.

Expected behavior
PurgeCSS should allow users to skip certain folders, such as node_modules—especially because these folders can contain thousands of subfolders and having PurgeCSS scan all of them needlessly makes you look slow and bad.

Screenshots
N/A

Environment (please complete the following information):

  • OS: macOS 11.2.2
  • Package purgeCSS
  • Version 4.0.0

Additional Context
There are other people asking for ways to exclude folders:
#551

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions