美好的一天!
我允许我的内容编辑器将CSS存储为非常基本的组件(通常包含一个称为"代码"的单个多行字段,然后将它们粘贴到其中),然后将这些字段作为组件演示文件添加到具有.css文件扩展名的页面中.创建页面时,用户可以设置一些配置值:minify output(bool),文件名前缀和文件名后缀.最后两个的意图是,如果用户选择在出门的时候缩小CSS,则文件名可以在演示服务器上不同.
除了修改文件名外,我已经完成了所有工作.我不想更改CM中的文件名; 只有它驻留在演示服务器上.我假设这可以在放入CSS页面模板的TBB中完成.我对它采取了一个裂缝,但我想确保没有我遗漏的东西.以下示例只是简写,其中一些可配置值为了简洁而进行了硬编码.
// 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.
Run Code Online (Sandbox Code Playgroud)