Assets and Dependencies ID: PM-GS-AD
This lesson goes into more detail about the fundamental building blocks of packages - assets and dependencies. Understanding how assets and dependencies work is critical to getting the most out of packages.
Assets
The fundamental building block of packages are their assets. An asset is any object that is copied or mapped from the source site to the site that the package is installed on. These may be anything from templates, javascript, stylesheets, to images, documents, articles, folders, and more.
Not all assets are the same, however. Package versions may have any of the following types of assets:
- Install and Update assets are the easiest type of asset to understand. When the package is installed on a site, these assets are copied to the site. If the asset already exists then they it is updated to match the package. Attempting to manually update one of these assets on the destination site will display a warning about creating potential conflicts with the package. This type of asset may only be included in a single source package.
- Install Only assets are copied to a site when the package is installed, but are NOT updated if the asset already exists on the destination. It is generally safe to edit these assets on the destination site, and they may be included in multiple source packages.
- Trashed assets were included in a previous package version but have since been trashed or deleted from the source site. These assets will be trashed on the destination site if they already exist when the package is updated on that site.
- Ignored assets will simply be ignored when the package is installed. One example of where this is useful is if you have trashed an asset on the source site but do not want to trash that asset on destination sites if it already exists.
- Map (Required), and Map (Optional) assets are similar to ignored and install only assets in that they are not considered to belong to the package. Instead, when installing a package on a site, users will be able to map all of these assets to assets on their own site before completing the installation. All references to these assets on the source site will be replaced by their mapped assets on the destination site, or removed if they are not mapped. Users will not be allowed to complete the installation with any empty Map (Required) mappings, although they may skip Map (Optional) assets if desired. One simple example might be a package containing calendar entries but no calendar. The calendar will instead be mapped from a calendar that already exists on the destination site.
Dependencies
In order for a package to work, sometimes they require other packages to be installed. Some examples of this may be javsacript or css frameworks use by a widget, or a page which utilizes widgets defined in other packages. As noted above, Install Only assets may only be included in a single package, and attempting to add the same asset to multiple packages will instead prompt to add the first package as a dependency of the second package.
Dependencies may have a minimum required version. If a minimum version is specified for a package dependency, users will not be able to complete package installation until all dependencies on the site have the minimum version or a later version of that package. If no minimum version is specified then any version of the package is allowable.
When installing a package on a site, users will automatically be prompted to add any dependent packages to the site at the same time if they are not already installed.