Creatio development guide
PDF
This documentation is valid for Creatio version 7.12.0. We recommend using the newest version of Creatio documentation.

Packages file content

Glossary Item Box

Introduction

Starting with version 7.11.3 you can add file content (.js, .css files, images, etc.) to the custom packages.

File content of packages is a number of any files used by the application. File content is static and is not processed by the web server (see “Client static content in the file system”). This increases application performance.

ATTENTION

File content is an integral part of the bpm’online and is always stored in the ...\Terrasoft.WebApp\Terrasoft.Configuration\Pkg\<Package name>\Files folder.

NOTE

Any files can be added to the package, but only the files needed for the client part of bpm'online will be used.

ATTENTION

You need to generate auxiliary files (see “Generation of auxiliary files” below) to use file content.

Recommended file storage structure

To use file content the Files folder was added to the package structure (see “Package structure and contents”). It is recommended to keep following structure of the Files folder:

-PackageName
    ...
    -Files
        -src
            -js
                bootstrap.js
                [other *.js files]
            -css
                [*.css files]
            -less
                [*.less files]
            -img
                [image files]
            -res
                [resource files]
        descriptor.json
    ...
descriptor.json

Here

js – folder with .js files of JavaScript source codes

css – folder with *.css style files

less – folder with *.less style files

img – folder with images

res – folder with resource files

descriptor.json – descriptor of the file content.

How to add a new file content to the package

Copy a file to the corresponding subfolder of the Files folder of specific package. The Files folder will be available by the ...\Terrasoft.WebApp\Terrasoft.Configuration\Pkg\<Package name>\Files path.

Descriptor of the file content

Information about bootstrap files of the package is stored in the descriptor.json file of the Files folder. The has following structure:

{
    "bootstraps": [
        ... // An array of strings containing relative paths to bootstrap files.
    ]
}

Example of descriptor.json:

{
    "bootstraps": [
        "src/js/bootstrap.js",
        "src/js/anotherBootstrap.js"
    ]
}

Bootstrap files of the package

The .js files that enable to manage loading of client configuration logic. The file does not have a clear structure.

(function() {
    require.config({
        paths: {
            "Module name ":" A link to the file content",
            ...
        }
    });
})();

Example of bootstrap.js:

(function() {
    require.config({
        paths: {
            "MyPackage1-ContactSectionV2": Terrasoft.getFileContentUrl("MyPackage1", "src/js/ContactSectionV2.js"),
            "MyPackage1-Utilities": Terrasoft.getFileContentUrl("MyPackage1", "src/js/Utilities.js")
        }
    });
})();

ATTENTION

All bootstrap files are loaded asynchronously after the core is loaded, but before loading the configuration.

Loading of the bootstrap files

For correct loading of bootstrap files, the _FileContentBootstraps.js auxiliary file is generated in the static content folder (see “Generation of auxiliary files” below). This file contains information about bootstrap files of all packages.

Example of the _FileContentBootstraps.js:

var Terrasoft = Terrasoft || {};
Terrasoft.configuration = Terrasoft.configuration || {};
Terrasoft.configuration.FileContentBootstraps = {
    "MyPackage1": [
        "src/js/bootstrap.js"
    ]
};

File content versioning

For correct versioning of the file content, the _FileContentDescriptors.js auxiliary file is generated in the static content folder (see “Generation of auxiliary files” below). This file contains information about the files in the file content of all packages in the "key-value” collection view. Each key (file name) corresponds to a unique hash code. This guarantees downloading of the up to date version of the file to the browser.

NOTE

After installing the file content, there is no need to clear the browser cache.

Example of the _FileContentDescriptors.js file:

var Terrasoft = Terrasoft || {};
Terrasoft.configuration = Terrasoft.configuration || {};
Terrasoft.configuration.FileContentDescriptors = {
    "MyPackage1/descriptor.json": {
        "Hash": "5d4e779e7ff24396a132a0e39cca25cc"
    },
    "MyPackage1/Files/src/js/Utilities.js": {
        "Hash": "6d5e776e7ff24596a135a0e39cc525gc"
    }
};

Generation of auxiliary files

Execute the BuildConfiguration operation in the WorkspaceConsole:

Terrasoft.Tools.WorkspaceConsole.exe -operation=BuildConfiguration -workspaceName=Default -destinationPath=Terrasoft.WebApp\ -configurationPath=Terrasoft.WebApp\Terrasoft.Configuration\ -useStaticFileContent=false -usePackageFileContent=true -autoExit=true

In this code:

  • operation – operation name. BuildConfiguration – operation of configuration compilation.
  • useStaticFileContent – a flag of using static content. Should be false.
  • usePackageFileContent – a flag of using file content of the packages. Should be true.

Other WorkspaceConsole parameters are described in the "WorkspaceConsole parameters” article.

As a result the _FileContentBootstraps.js and _FileContentDescriptors.js auxiliary files will be generated in the folder with the static content ...\Terrasoft.WebApp\conf\content.

ATTENTION

Also the generation of auxiliary files is performed at installation of packages from SVN and executing compilation action in the [Configuration] section.

Transition of modifications between environments

File content is an integral part of the package. The content is stored in the SVN store with all package content. The content can be transferred to another development environment via SVN ( see “Working with SVN in the file system” ).

ATTENTION

It is recommended to use bpm’online built-in tools to transfer on test and production environments (see”Exporting packages from the application interface” and “Installing marketplace applications from a zip archive”).

© bpm'online 2002-2019.

Did you find this information useful?

How can we improve it?