Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

bug(options): whitelisting options doesn't work #9

@Kristinita

Description

@Kristinita

#7 — related issue. @Ffloriel, ping.

1. Summary

Any PurgeCSS whitelisting options doesn't work for me.

2. Data

2.1. Environment

  • Operating system:

    • Windows 10 Enterprise LTSB 64-bit EN — local
    • Ubuntu 14.04.5 LTS
  • Node.js 11.10.0

  • purgecss 1.1.0

  • grunt 1.0.3

  • grunt-purgecss 1.1.0

  • grunt-cli 1.3.2

3. Files

Look at KiraPurgeCSS branch of my demo repository:

  • KiraGoddess.html:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>PurgeCSS debugging</title>
</head>
<body>
    <p class="KiraFirst">Kira</p>
</body>
</html>
  • KiraGoddess.css:
.KiraFirst {
    color: red
}

.KiraSecond {
    color: yellow
}
  • Gruntfile.coffee:
module.exports = (grunt) ->
    grunt.initConfig
        purgecss:
            options:
                content: ["KiraGoddess.html"]
                whitelist: [".KiraSecond"]
                whitelistPatterns: [/\.KiraSecond/g]
                whitelistPatternsChildren: [/\.KiraSecond/g]
            main:
                files:
                    "KiraGoddess.css": ["KiraGoddess.css"]

    grunt.loadNpmTasks 'grunt-purgecss'
    return

4. Steps to reproduce

4.1. PurgeCSS CLI

purgecss --css KiraGoddess.css --con KiraGoddess.html --out . --whitelist KiraSecond

4.2. grunt-purgecss

grunt purgecss

5. Behavior

5.1. Expected — CLI

.KiraFirst {
    color: red
}
.KiraSecond {
    color: yellow
}

purgecss-CLI successful ignore .KiraSecond class.

5.2. Unexpected — Grunt

.KiraFirst {
    color: red
}

grunt-purgecss not ignore .KiraSecond class.

Note, how Grunt show options:

Options: content=["KiraGoddess.html"], whitelist=[".KiraSecond"], whitelistPatterns=[{}], whitelistPatternsChildren=[{}]

6. Not helped

  1. Remove \. and /g from patterns
  2. Adding ^ and $ to regexes as in example

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions