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

Globs don't work from the configuration file #80

Closed
morrislaptop opened this issue Apr 22, 2018 · 7 comments · Fixed by #81
Closed

Globs don't work from the configuration file #80

morrislaptop opened this issue Apr 22, 2018 · 7 comments · Fixed by #81
Assignees
Labels

Comments

@morrislaptop
Copy link
Contributor

module.exports = {
  content: ['.vuepress/dist/*.html'],
  css: ['.vuepress/dist/assets/css/*.css'],
}

Actual
Results in Error: ENOENT: no such file or directory, open '.vuepress/dist/assets/css/*.css'
Before you open an issue, please check if a similar issue already exists or has been closed before.

Expected
Not throw error at https://github.com/FullHuman/purgecss/blob/master/src/index.js#L116

Version: 0.21.0

The glob is resolved using the CLI magically somehow.

@jsnanigans
Copy link
Member

I think the problem might be that the directory .vueress/dist/ does not exists. Please try ./vuepress/dist/? if that also does not work then purgecss runs before the build is complete

@morrislaptop
Copy link
Contributor Author

Where did you see .vueress? My workaround is the below atm:

const glob = require('glob')

let css = glob.sync('.vuepress/dist/assets/css/*.css')

module.exports = {
  content: ['.vuepress/dist/*.html'],
  css,
}

@jsnanigans
Copy link
Member

That was a typo I meant .vuepress/dist/ my point is that it seems unlikely that you have a directory called .vuepress that starts with a .

I cant really tell what the issue is without more information, could you maybe share your repo where that problem occurred?

@morrislaptop
Copy link
Contributor Author

It does start with a .. Check out https://github.com/vuejs/vuepress repo.

The problem is that the CSS array of globs is resolved when it goes through extractFileSelector but is not resolved when it goes through getCssContents.

Cheers,
Craig

@jsnanigans
Copy link
Member

Oh, I see now. This is a major bug.. and no one noticed this before, probably because the tests don't use the array syntax for css..

Thanks for reporting this, Ill fix it as soon as I get home today.

@jsnanigans jsnanigans added the bug label Apr 23, 2018
@jsnanigans jsnanigans self-assigned this Apr 23, 2018
@morrislaptop
Copy link
Contributor Author

Working on a PR :)

morrislaptop added a commit to morrislaptop/purgecss that referenced this issue Apr 23, 2018
@morrislaptop morrislaptop mentioned this issue Apr 23, 2018
4 tasks
@morrislaptop
Copy link
Contributor Author

@jsnanigans done!

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

Successfully merging a pull request may close this issue.

2 participants