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

purgecss + gulp + custom extractor-> Cannot read property 'extractor' of undefined #95

Closed
sebastianbaumann opened this issue Jun 22, 2018 · 3 comments

Comments

@sebastianbaumann
Copy link

hey there!

I'm desperately trying to use purgecss with a custom extractor, but I keep getting the following error when running my gulp file.

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Cannot read property 'extractor' of undefined

this is the purgecss gulp task

gulp.task('purge', () =>
	gulp.src('./../css/main.css')
		.pipe(purgecss({
			content: ['./../templates/**/*.html.twig'],
			extractors: [
				{
					extractor: TailwindExtractor,
					extensions: ['css', 'html']
				}
			]
		}))
		.pipe(gulp.dest(path.cssDest))
);

what am I doing wrong?

@jsnanigans
Copy link
Collaborator

Try adding twig to the extensions for that extractor, if you are not using any html files you can remove html and you can remove css too, the extensions option tells purgecss what file types that extractor is for, and since you have no extractor for twig files it throws that error

@sebastianbaumann
Copy link
Author

@jsnanigans You're the man!
Thank you so much! Saved my weekend.
I totally misunderstood for what extensions: [] is used for. Sorry!

@jsnanigans
Copy link
Collaborator

I'm glad I could help!
no reason to apologize :)

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

No branches or pull requests

2 participants