The package file content comprises files (*.js, *.css, images, etc.) added to custom Creatio packages. Since the file content is static, the webserver does not process it. This helps to improve Creatio performance.
The types of file content:
- Client content generated in real time.
- Pre-generated client content.
Special aspects of client content generated in real time:
- The pre-generation of client content is not needed.
- The calculation of package and schema hierarchy, as well as the generation of content, put a load on the CPU.
- The retrieval of package and schema hierarchy, as well as the generation of content, put a load on the database.
- The caching of client content takes up memory.
Special aspects of pre-generated client content:
- The load on the CPU is minimal.
- The pre-generation of client content is required.
- The database queries are not needed.
- The IIS tools cache the client content.
Storage structure of package file content
File content is an integral part of the package. You can pre-generate the file content in the dedicated ...\Terrasoft.WebApp\Terrasoft.Configuration\Pkg\<PackageName>\Files Creatio directory to improve Creatio performance and reduce the load on the database. If the IIS server receives a request, it will search for requested content in this directory and send the content to Creatio immediately. You can add any files to the package, however, Creatio will use only the files required for its client part.
We recommend structuring the Files directory as below.
js – the directory with JavaScript *.js source code files
css – the directory with *.css style files
less – the directory with *.less style files
Img – the directory with images
res – the directory with resource files
descriptor.json – the file content descriptor that stores the information about package bootstrap files
View the descriptor.json file structure below.
To add file content to a package, place the file in the corresponding subdirectory of the Files package directory.
Package bootstrap files
Package bootstrap files are *.js files that handle the loading of client configuration logic. The file structure may vary.
Creatio loads bootstrap files asynchronously after loading the core, but before loading the configuration. Creatio generates _FileContentBootstraps.js auxiliary file in the static content directory to ensure the bootstrap files are loaded correctly. The auxiliary file contains information about bootstrap files of all packages.
File content versioning
Creatio generates _FileContentDescriptors.js auxiliary file in the static file content directory to ensure the file content versioning works correctly. The auxiliary file contains information about files in the file content of all packages, displayed as a “key-value” collection. Each key (filename) corresponds to a unique hash code. This ensures the browser will receive the up-to-date file version.
Auxiliary file generation
To generate auxiliary files (_FileContentBootstraps.js and FileContentDescriptors.js), execute the BuildConfiguration operation using the WorkspaceConsole utility.
Parameter | Description |
---|---|
The name of the operation. Set the value to BuildConfiguration – the operation that compiles the configuration. | |
Enables the static content. Set the value to false. | |
Enables the package file content. Set the value to true. |
As a result, Creatio will generate _FileContentBootstraps.js and _FileContentDescriptors.js auxiliary files in the ...\Terrasoft.WebApp\conf\content static content directory.
Learn more about the parameters of the utility: WorkspaceConsole parameters.
Static file content pre-generation
Creatio generates the file content in the .\Terrasoft.WebApp\conf special directory. The directory contains *.js files with schema source code, *.css style files, *.js resource files of all Creatio cultures, as well as images.
The following events trigger static file content generation or re-generation:
- Saving a schema in the Client Schema Designer and Client Objects Designer.
- Saving in the Section Wizard and Detail Wizard.
- Installing and deleting applications via Marketplace and *.zip archive.
- Applying translations.
- Running Compile and Compile all actions in the Configuration section.
Run these actions after you delete schemas or packages from the Configuration section.
Run the Compile all action after you install or update a package from SVN version control system.
File content generation
To generate the file content, execute the BuildConfiguration operation using the WorkspaceConsole utility.
Parameter | Description |
---|---|
The workspace name. Set to Default by default. | |
The directory to which to generate the static content. | |
Path to the web application from which to read the information about the connection to the database. Optional. If you do not specify a value, Creatio will establish a connection to the database specified in the connection string of the Terrasoft.Tools.WorkspaceConsole.config file. If you specify a value, Creatio will establish the connection to the database from the ConnectionStrings.config file of the web application. |
|
Optional. Set to false by default. If you leave the value as is, Creatio will generate the file contents only for modified schemas. If you set the value to true, Creatio will generate the content for all schemas. |
Client content generation when adding a new culture
After you add new cultures in the Creatio UI, run the Compile all action in the Configuration section.
Retrieve the image URL
The browser requests images in the client part of Creatio with the URL specified in the src attribute of the img HTML element. Creatio generates this URL using the Terrasoft.ImagesUrlBuilder (imagurlbuilder.js) module with the getUrl(config) public method for retrieving the image URL. This method expects the config JavaScript configuration object that contains the parameters object in the params property. Creatio generates the image URL to add to the page based on this property.
schemaName – the schema name (string)
resourceItemName – the image name in Creatio (string)
Hash – the image hash (string)
resourceItemExtension – the image file extension. For example, “.png.”
View the example that generates the parameters configuration object needed to retrieve the static image URL below
Compatibility with the file system development mode
It is not possible to retrieve client content from pre-generated files in the file system development mode. To ensure the correct operation of the file system development mode, disable the retrieval of static client content from the file system. To disable this feature, set the UseStaticFileContent flag in the Web.config file to false.
Transfer changes between environments
File content is an integral part of the package. The content is stored in the version control system repository along with other package content. You can transfer the file content to another environment:
- We recommend using the SVN version control system to transfer changes to the development environment.
- We recommend using the export and import mechanism in Creatio IDE to transfer changes to pre-production and production environments.