Minify & Purge HTML/CSS/JSS

Viewed 286

I use GitHub for source control my HTML, CSS and JS. I use Netlify / Cloudflare Pages to host my website (which is trigger off of a GitHub commit).

I work with static files (.html, .js and .css) and do not use programming frameworks like Ruby on Rails, Django, etc.

I’d like to create a GitHub Action that triggers on a git commit, to do the following:

a. Purge unused CSS. b. Minify the HTML, CSS and JS c. In-line the CSS & JS into the HTML file.

That way my site is minified, merged and purged of unused elements before it is automatically hosted by Netlify / Cloudflare Pages.

How would I go about doing this with GitHub Actions? I’ve looked into esbuild, webpack etc but all seem to come up short of being able to do all I need.

0 Answers
Related