How can I process some files while deploying (without leaving around artifacts)

Hey y’all. I have a python(3) sls project that has a function that returns an HTML document.

I have a template at templates/index.html. That file uses mustache to interpolate in some data when the function executes.

I also have some css files in templates/styles/. I would like to, at deploy time, minify and concatenate those css files, and insert them as an inline style in my index.html. I can easily write a script to do the minification/concatenation/insertion on index.html, but I end up actually mutating my index.html in the project directory. I would like the index.html that exists in the deployment zip to have those changes, but not my source index.html.

I’m not opposed to using/writing a plugin, but I’m having trouble figuring out the right approach.