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 cant be fully replaced #41

Closed
ctf0 opened this issue Aug 6, 2018 · 5 comments
Closed

globs cant be fully replaced #41

ctf0 opened this issue Aug 6, 2018 · 5 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ctf0
Copy link
Contributor

ctf0 commented Aug 6, 2018

according to
https://github.com/spatie/laravel-mix-purgecss/blame/master/README.md#L92-L93

adding

globs: [
   path.join(__dirname, 'node_modules/simplemde/**/*.js'),
],

should replace the package defaults, but because of

this.options.globs.push(
rootPath('app/**/*.php'),
...flatMap(this.options.folders, folder => {
return this.options.extensions.map(extension =>
rootPath(`${folder}/**/*.${extension}`)
);
})
);

this is not possible and you are basically adding an extra entry point to be scanned.

also https://github.com/spatie/laravel-mix-purgecss#usage-outside-of-laravel is not true because if root/app/ is not found you will get an error.

to test

btw globs extension could be omitted https://github.com/FullHuman/purgecss-webpack-plugin/blame/master/README.md#L68 as purgecss will use the extensions option to fill it.

@sebastiandedeyne
Copy link
Member

Globs aren't meant to ever fully replaced, this is mentioned in the readme:

If you need to fully replace the globs, use the underlying paths option instead.

I do agree that the hard coded app should go. I think this can be moved to folders, doesn't really matter if app gets scanned for more extensions than PHP.

@sebastiandedeyne sebastiandedeyne added help wanted Extra attention is needed good first issue Good for newcomers labels Aug 9, 2018
@ctf0
Copy link
Contributor Author

ctf0 commented Aug 9, 2018

am not sure what this part means

use the underlying paths option instead.

still i can make a PR with a check for globs & if empty then fallback to

this.options.globs.push( 
     ...flatMap(this.options.folders, folder => { 
         return this.options.extensions.map(extension => 
             rootPath(`${folder}/**/*.${extension}`) 
         ); 
     }) 
 ); 

@sebastiandedeyne
Copy link
Member

globs is not a Purgecss option, it's custom made for this wrapper. paths is the actual configuration property. If you specify a custom paths option, globs will be completely ignored.

https://github.com/FullHuman/purgecss-webpack-plugin#paths

mix.purgeCss({ paths: ... })

@ctf0
Copy link
Contributor Author

ctf0 commented Aug 9, 2018

oh okay, so which PR do u prefer ?

@sebastiandedeyne
Copy link
Member

Feel free to send a PR that improves the docs regarding paths vs. globs. However, we're going to keep globs as the recommended configuration, and not going to change it's behavior. For most people, globs is more than enough and is easier to configure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants