HCL Commerce Version 9.0.0.5 or later

Rebuilding store code

You can rebuild the store code, such as JavaScript and CSS files, by using Grunt plugins.

About this task

For optimal store performance, all JavaScript and CSS files are kept to a minimum inside the store and widget directories. As a result, you must complete this task every time you update your store code, so that the store can apply your changes.

Procedure

  1. Set up your environment to rebuild store code.
    1. Go to the following directory on your development environment.

      WCDE_installdir\sample\stores\BuildScript\

      Note: This package is only available in HCL Commerce Developer version 9.0.0.5+.
    2. Extract the contents of the recompileTool.zip package to the WCDE_installdir/workspace/crs-web/WebContent directory.
    3. Download and install node.js and npm tooling:
      1. Download and install node.js and npm from nodejs.org.
      2. Ensure that the path environment variables are added after install, so that all commands work correctly from any directory on the command line.
    4. Run the following commands in sequence:
      Note: The Bower installation is supported for npm version V6.14.17.
      
      root_dir>
      npm install -g bower
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\vendorWidgets>
      npm install
      bower install
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\vendorWidgets>
      npm install
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\allInOne>
      npm install
      Ensure that each command runs successfully. Then, your environment is set up to rebuild store.
      Note: Bower might return a deprecated message. This can safely be ignored.
  2. Rebuild your store's code.
    1. Run the following commands in sequence:
      For development environments, use the grunt dev command, which only merges the code to make it easier for you to debug:
      
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\vendorWidgets>
      grunt dev -storename=your_store_name
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\allInOne>
      grunt dev -storename=your_store_name
      For production environments, use the grunt prod command, which uglifies and merges the code to increase load efficiency:
      
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\vendorWidgets>
      grunt prod -storename=your_store_name
      WCDE_installdir\workspace\crs-web\WebContent\recompileTool\allInOne>
      grunt prod -storename=your_store_name

      Where your_store_name is your store name. For example, AuroraB2BStorefrontAssetStore.

      Ensure that each command runs successfully. Then, your store code has been recompiled.

    Note: Make sure to remove the recompileTool folder from web content after you finish compiling the store.js file. This prevents the build script from getting deployed to the runtime environment.