Skip to content

4.1.0 broke my .purgecss config #802

Closed
@folknor

Description

@folknor

Describe the bug
It doesn't find the files any more.

To Reproduce
Steps to reproduce the behavior:

  1. Create a folder dist with a CSS file
  2. Create a .purgecss file with the content as below
  3. In the folder above, run pcss --config ./.purgecss

Additional context

module.exports = {
	content: ["dist/*.html", "dist/*.js"],
	css: ["dist/*.css"],
	output: "dist",
	keyframes: true,
	variables: true,
	safelist: ["animate__animated", "animate__fadeOut", "animate__fadeIn", "text-white"],
}

I have purgecss installed globally and aliased:

$ which pcss
/home/folk/.local/bin/pcss
$ file /home/folk/.local/bin/pcss
/home/folk/.local/bin/pcss: symbolic link to /home/folk/.npm-global/bin/purgecss

Results

ENOENT: no such file or directory, open 'undefined/index.065427ae.css'
ENOENT: no such file or directory, open 'undefined/index.505a1436.css'

Activity

folknor

folknor commented on Nov 29, 2021

@folknor
Author

If I just run the command without using a .purgecss file, it works fine:

$ ls -l dist/index.505a1436.css
.rw-rw-r-- 243k folk 29 nov.  21:24 dist/index.505a1436.css
$ pcss -con '["dist/*.html", "dist/*.js"]' -css 'dist/*.css' -o dist -keyframes -v --safelist '["animate__animated", "animate__fadeOut", "animate__fadeIn", "text-white"]'
$ ls -l dist/index.505a1436.css
.rw-rw-r-- 2,7k folk 29 nov.  21:24 dist/index.505a1436.css
Ffloriel

Ffloriel commented on Nov 29, 2021

@Ffloriel
Member

The output directory was wrongly set for the CLI. This should be fixed in 4.1.3.

folknor

folknor commented on Nov 29, 2021

@folknor
Author

Yes it works now :-) Another issue I just noticed now is that when I run the command 2 times it reduces the size further;

$ ls -l dist/index.505a1436.css
.rw-rw-r-- 243k folk 29 nov.  22:42 dist/index.505a1436.css
$ pnpm run css:purge (alias for pcss --config ./.purgecss)
$ ls -l dist/index.505a1436.css
.rw-rw-r-- 33k folk 29 nov.  22:42 dist/index.505a1436.css
$ pcss -con '["dist/*.html", "dist/*.js"]' -css 'dist/*.css' -o dist -keyframes -v --safelist '["animate__animated", "animate__fadeOut", "animate__fadeIn", "text-white"]'
$ ls -l dist/index.505a1436.css
.rw-rw-r-- 2,7k folk 29 nov.  22:42 dist/index.505a1436.css

However, if I do pnpm run css:purge the second time, the size does not change. Is it because -con '["dist/*.html", "dist/*.js"]' is invalid? I tried -con 'dist/*.html, dist/*.js' as well and it also further reduces the size.

Ffloriel

Ffloriel commented on Nov 29, 2021

@Ffloriel
Member

Yes, it looks like the format is incorrect for --con. It should be --con dist/*.html dist/*.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @folknor@Ffloriel

        Issue actions

          4.1.0 broke my .purgecss config · Issue #802 · FullHuman/purgecss