Managing Assets
Managing Assets
Application Assets
Application assets are located in <EPsource>/ep-assets/application-assets/src/main/assets. These resources are required to run the Elastic Path Commerce Manager application. These assets include:
- cmassets - Commerce Manager assets, containing velocity templates used in the Commerce Manager client.
- content-wrappers
- import - Commerce Manager .csv files, (used for importing products, jobs, catalogs, etc)
Store Assets
Store assets are located in <EPsource>/stores/snapitup-assets/src/main/assets. These resources are required to run the Storefront and the Cortex. These assets include:
- dynamiccontent (assets used by your Dynamic Content)
- images (images used by your catalog data)
- storeassets (Miscellaneous store assets)
- themes (the look-and-feel related resources, including Velocity templates, CSS files, Javascript files, and storefront images)
- digital assets (downloadable binaries, such as software, images, etc) located in <EPsource>/store-data/camera-stores/data/iepackage/digitalassets
Deploying Assets Locally
The following command builds your assets directory on your local computer at C:\users\<username>\ep-assets. The command creates the ep-assets folder with symbolic links that link to the application and storefront assets in your source release.
- From the source root run:
mvn -f asset-repository/pom.xml generate-resources
Deploying Assets for Production
The following command builds your assets (application and storefront) into a zip file and deploys the zip file to your Maven repository. You can either deploy the assets.zip on your production server, or, if you have a Nexus server available, you can deploy your assets from there. To build and deploy the assets.zip,
- In the command line, navigate to <EPSource>\asset-repository\assets\assets-zip and run the following command:
mvn package
The assets.zip containing the Store Assets and Application Assets builds to your target folder and is deployed to your Maven repository at ..\.m2\repository\com\elasticpath\assets-zip
Specifying the Asset Path
By default, assets are built into the C:\users\<username>\ep-assets directory. You can change this default by modifying the assetLocation setting in the Commerce Manager Client.
- Log on to the Commerce Manager Client.
- In the Activity menu, choose Configuration.
- In the Configuration menu, choose System Configuration.
- In the Filter, enter COMMERCE/STORE/ASSETS/assetLocation
- In the Setting Name menu, select the assetLocation setting
- Under Defined Values, select the default setting and click the Edit... button.
- Under Value, enter your new asset location.
- Click Save to apply your changes.
- From the source root, run the following Maven command to build symbolic links to your new asset location:
mvn -f stores/snapitup-populate-database/pom.xml process-resources -P update-settings
Configuring the Asset Path Before Building
You can configure the asset location before you build by adding the following profile in your .m2\settings.xml file and replacing the location to point to your preferred directory:
<profile> <id>ep-asset-path</id> <properties> <ep.local.asset.path>${user.home}/ep-assets</ep.local.asset.path> </properties> </profile>
Make sure you add this profile in your .m2\settings.xml active profiles:
<activeProfiles> <activeProfile>ep-asset-path </activeProfile> ...
Demo catalogs, (mobee, snapitup, etc) have different assetServerBaseUrl settings. If you switch between demo stores, your asset URLs will change.
Specifying the Assets Server URL
The assetServerBaseUrl setting defines the URL where your media assets are located. For example, if www.samplestore.com's assetServerBaseUrl was https://media.samplestore.comhttp://mobee.elasticpath.com:8080;then image URLs would look like: https://media.samplestore.com/thumbnail_hd.jpg.
To change the Asset Server URL:
- Log on to the Commerce Manager Client.
- In the Activity menu, choose Configuration.
- In the Configuration menu, choose System Configuration.
- In the Filter, enter COMMERCE/STORE/ASSETS/ assetServerBaseUrl.
- In the Setting Name menu, select the assetServerBaseUrl setting.
- Under Defined Values, click the New... button.
- Under Context, enter your StoreCode.
- Under Value, enter your asset server URL.
- Click Save to apply your changes.