Text replacement in stylesheets and template files
When Build copies files from the shared folder to the user's working folder for a project, it is able to open those files and make text replacements in them. Currently, this is required only for stylesheet and template files that contain references to the image cache, but you could extend the feature to make replacements for other reasons as well.
Stylesheet and template files in the shared templates folder (FMRoot\Shared\Templates) use the placeholder /%image cache url%/ in references to image files. When a stylesheet or template file is copied into a project’s folder, this placeholder needs to be replaced with the proper URL for the image cache. Since this needs to happen automatically, the file types, the placeholder text, and the replacement text are all defined using keys in Build’s Web.config file.
Default values
The default settings are as follows:
<appSettings>
<add key="ReplaceText_MimeTypes" value="text/css" />
<add key="ReplaceTextEncode_MimeTypes" value="text/html" />
<add key="ReplaceText_FindValue" value="/%image cache url%/" />
<add key="ReplaceText_NewValue"
value="/SPSSMR/ImageCache/ImageCache.aspx?project={project}&file=" />
</appSettings>
Keys
ReplaceText_MimeTypes
A semicolon-delimited list of mime types in which Build makes replacements.
The default is text/css, which means that files with a .css extension will be subject to text replacement.
ReplaceTextEncode_MimeTypes
A semicolon-delimited list of mime types in which Build makes replacements. The replacement text is HtmlEncoded before insertion in the files.
The default is text/html, which means that files with a .html extension will be subject to text replacement.
ReplaceText_FindValue
The placeholder text to be replaced. The default is:
/%image cache url%/
ReplaceText_NewValue
The replacement text to be inserted. The default is:
/SPSSMR/ImageCache/ImageCache.aspx?project={<project>}&file=
Build replaces <project> with the name of the current project.
See also