Extend a Sass File

Documentation article about Extend a Sass File

·3 min read·View Oracle Docs

Important:

Making changes to core JavaScript source files or changing vital functionality of the application can make migrating to future releases difficult. Before making changes to SuiteCommerce Advanced (SCA), see Best Practices for Customizing SCA.

This topic describes how to extend a Sass file if you are on the Kilimanjaro release of SCA or earlier. If implementing the Aconcagua release of SCA or later, the best practice is to use themes and extensions to customize your website. See Develop Themes and Develop Extensions for more information.

SCA enables you to customize your website to easily apply global style changes while supporting migration to later versions. When customizing styles, you create a custom module that overrides specific Sass variables already defined in the BaseSassStyles module. You then redefine application dependencies so that base Sass styles import your customizations in the correct order.

This example shows how to create a custom module to change the default background and foreground colors.

To extend a Sass file:

  1. Create the directory structure to store your custom module.

    1. Create a directory called extensions. Where you place this depends on your implementation.

      • If implementing 2019.2 and later, create the extensions directory within the SC_xxx directory within your root source directory. Examples: SC_20.1/extensions, SC_19.2_Live/extensions.

      • If implementing 2019.1 and earlier, create the extensions directory within the Modules directory. For example: Modules/extensions.

    2. In the extensions directory, create a subdirectory called CustomSass@1.0.0.

      When creating a new custom module, the module name must be unique. You must not have duplicate module names, even if those modules reside in different folders.

    3. In the CustomSass@1.0.0 directory, create a subdirectory called Sass.

    In general, when creating custom modules, you should create a directory structure similar to that described in the procedure above. See Organize Source Code for Custom Modules for more information.

  2. Create a Sass file.

    1. In the Sass directory, create a new file called _custom-sass.scss.

    2. Add Sass variable definitions to this file.

      These variable definitions override the base Sass variables defined in the BaseSassStyles module. See Design Hierarchy for more information.

      css
      1$sc-color-primary: #0000ff; // originally #f15c28;
      2 $sc-color-secondary: #00ff00; //originally #5B7F8C;
      3 $sc-color-theme: #00ff00; //originally #5B7F8C;
      4 $sc-color-link: #00ff00; //originally #2f9ac3;
      5 $sc-color-theme-light: #00aa00; // originally #9cb6bf
      6 $sc-color-theme-background: #000000;
      7
      8 $sc-color-dark-copy: #e7d13b; // originally #1f2223;
      9 $sc-color-copy: #ede39f; //originally #404040;
      10 body {
      11 background-color: $sc-color-theme-background;
      12 }
  3. Create the ns.package.json file.

    1. Create a file called ns.package.json in the CustomSass@1.0.0 directory.

    2. Add the following code to the ns.package.json file.

      json
      1{
      2 "gulp": {
      3 "sass": [
      4 "Sass/**/*.scss"
      5 ]
      6 }
      7}
  4. Update the distro.json file.

    1. Add an entry for your CustomSass@1.0.0 module to the distro.json file.

      • If implementing 2019.2 and later, the distro.json file is located in the Advanced directory of the SCA source code. Examples: SC_20.1/Advanced/distro.json, SC_19.2_Live/Advanced/distro.json

        json
        1{
        2 "name": "SuiteCommerce Advanced Live",
        3 "version": "2.0",
        4 "isSCA": true,
        5 "buildToolsVersion": "Live",
        6 "folders": {
        7 "thirdPartyModules": "../../third_parties",
        8 "distribution": "../LocalDistribution",
        9 "deploy": "../DeployDistribution"
        10 },
        11 "modules": {
        12 "extensions/CustomSass": "1.0.0",
        13 "Account",
        14 "Balance",
        15 ...
      • If implementing 2019.1 and earlier, the distro.json flie is located in the root directory of your SCA source code.

        json
        {
        "name": "SuiteCommerce Advanced Mont Blanc",
        "version": "2.0",
        "buildToolsVersion

Frequently Asked Questions (4)

Does extending a Sass file apply to SuiteCommerce Advanced (SCA) Kilimanjaro release or later versions?
Extending a Sass file applies to the Kilimanjaro release of SCA or earlier. For the Aconcagua release or later, it's recommended to use themes and extensions for customization.
Where should I create the extensions directory for customizing Sass in SuiteCommerce Advanced?
If you are using 2019.2 and later, create the 'extensions' directory within the 'SC_xxx' directory in your root source directory. For 2019.1 and earlier, create it within the 'Modules' directory.
What should I include in the ns.package.json file for a custom Sass module?
In the ns.package.json file, add a 'gulp' key with a 'sass' property listing 'Sass/**/*.scss' to define where your custom Sass files are located.
How do I update the distro.json file to include a custom Sass module?
For 2019.2 and later, add an entry for 'CustomSass@1.0.0' in the 'modules' section of the distro.json file located in the Advanced directory. For 2019.1 and earlier, update the distro.json file located in the root directory of your SCA source code.
Source: Extend a Sass File Oracle NetSuite Help Center. This article was generated from official Oracle documentation and enriched with additional context and best practices.

Was this article helpful?

More in General

View all General articles →