Good day!
I allow my content editors to store CSS as very basic components (usually containing a single, multi-line field called "code" that they paste into), and these are then added as Component Presentations into a Page with a .css file extension. When creating the page, users are able to set a few configuration values: minify output (bool), file name prefix, and file name suffix. The intent of those last two is that if the user has selected to minify the CSS on its way out the door, the file name can be different sitting on the presentation server.
I've got everything working except the modification of the file name. I don't want to change the file name in the CM; only as it resides out on the presentation server. I assume this can be done in a TBB placed into the CSS Page Template. I took a crack at it, but want to be sure that there's not something I'm missing. The following example is just the shorthand with some configurable values hard-coded for brevity.
// Create a reference to the Page object in the package.
Page page = this.GetPage();
// Retrieve a reference to the page's file name.
string currentFileName = Utilities.GetFilename(page.FileName);
// Set the published file name on its way out the door.
page.FileName = currentFileName + "_min";
// ???
// Profit.