Organize Source Files for Multi-site

If you are implementing the Aconcagua release of SCA or later, best practice is to use themes and extensions to extend your website. Themes and extensions are available for installation as bundled SuiteApps or as custom themes and extensions deployed by in-house developers. After installing or deploying, the associated theme or extension can be activated for any domain associated with a website record. You must perform the activation for each site and domain you intend to use the theme or extension. No source code organization is necessary. See Themes & Extensions for details.

Note:

For details on creating themes and extensions, see Develop Themes, Develop Extensions, and Extensibility API.

If you are implementing SuiteCommerce Advanced and not using themes and extensions, you must perform some set up tasks to allow multi-site development. You can also create custom modules that define different features for each website. You can also maintain different code bases for each website.

SCA lets you manage multiple websites using the same code base. This means that functionality that is common to each website uses the same core module code. Also, any customizations or extensions you create for a specific website are managed in the same way as other modules.

If you are customizing SCA and not using themes and extensions, see Develop Your SCA Customization for information on creating custom modules.

For example if you were customizing the Header module for two different websites, you might have a directory structure as follows:

          Modules
      suite_commerce
            <shared modules>
      custom_modules
            Header_Site1
            Header_Site2 

        

In this example, the customized code is contained within the custom_modules directory. All source code shared among websites resides in the Modules/suite_commerce directory.

To determine which modules are included in a website, each website uses its own distro.json file. See The distro.json and ns.package.json Files for information about the distro.json file. The json.distro for a specific website is stored in a website-specific subdirectory within the Sites directory. The Sites directory is contained in the top-level directory of the SuiteCommerce Advanced source code. Thus, when managing multiple sites, you may have a directory structure containing directories similar to the following:

          Modules
      suite_commerce
            <shared modules>
      custom_modules
            Header_Site1
            Header_Site2
Sites
      site1
            distro.json
      site2
            distro.json 

        

You can compile and deploy the code for a specific website by running the gulp tasks from the site-specific subdirectory. For example, to compile and deploy Site 1, you would navigate to the site1 directory and run the required gulp tasks. See Deploy SCA Customizations to NetSuite and Test SCA Customizations on a Local Server for more information.

Related Topics

General Notices