Documentation > CMS Template API Library > Asset > SaveSource(String,Boolean)
SaveSource
Updates the source of a template or library file. This will automatically trigger the template or library code to compile if necessary.
public System.Boolean SaveSource(String,Boolean)
Returns
true if successful, false if not. Check outbound context.Error for specific error message
Parameters
Name | Description | Type |
---|---|---|
source | The template or library source code to be saved. | System.String |
compileAsync | Compiles the source asynchronously. Defaults to false. | System.Boolean |
Code Example
C#
Sample:
Asset codeAsset = Asset.Load("/Path/CodeFile"); string code = ... // source code; if(!codeAsset.SaveSource(code)) { Out.DebugWriteLine("Save Source Error: " + context.Error); }