Purgecss: Is there a way to make this work in Gulp for *.cshtml files?

Created on 14 Aug 2018  路  1Comment  路  Source: FullHuman/purgecss

Title explains all that I'm asking really:

Is there a way to make this work in Gulp for *.cshtml files?

Would be a great feature if it's not already there as I can't find anything on it!

Thanks in advance!

Most helpful comment

Purgecss can work with any file type, all it really does is apply the "extractor" (which is at its core just a regular expression) to the file you give it, check out how to use them and make your own extractor here:
https://www.purgecss.com/extractors#using-an-extractor
you will need to create an extractor and pass it with the options extensions: ['cshtml'].

It might work to just use the purge-from-html extractor on cshtml.

keep in mind that because purgecss does not compile the cshtml files the purge might not be 100% as you would expect.. for example if you are generating classes or ids then purgecss probably wont find them. you can use this to amend that: https://www.purgecss.com/whitelisting

>All comments

Purgecss can work with any file type, all it really does is apply the "extractor" (which is at its core just a regular expression) to the file you give it, check out how to use them and make your own extractor here:
https://www.purgecss.com/extractors#using-an-extractor
you will need to create an extractor and pass it with the options extensions: ['cshtml'].

It might work to just use the purge-from-html extractor on cshtml.

keep in mind that because purgecss does not compile the cshtml files the purge might not be 100% as you would expect.. for example if you are generating classes or ids then purgecss probably wont find them. you can use this to amend that: https://www.purgecss.com/whitelisting

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikecousins picture mikecousins  路  9Comments

spaceemotion picture spaceemotion  路  4Comments

JounQin picture JounQin  路  8Comments

Akumzy picture Akumzy  路  5Comments

joneldiablo picture joneldiablo  路  6Comments