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!
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
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-htmlextractor 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