Skip to main content

Building a theme

To build a theme:

  1. Change to the theme directory you cloned from github.

    1
    # !ref Directory from which you run the build or start the server.
    2
    .
    3
    ├── README.md
    4
    ├── _build/
    5
    # !ref Built theme.
    6
    │ └── brightspot-theme-frost-x.x.x-SNAPSHOT.zip
    7
    ├── babel.config.js
    8
    ├── com/
    9
    ├── etc/
    10
    ├── gulpfile.js
    11
    ├── node_modules/
    12
    ├── package.json
    13
    ├── postcss.config.js
    14
    ├── styleguide/
    15
    ├── webpack.*.js
    16
    └── yarn.lock
  2. Ensure you have version 12 or later of node installed: nvm ls. Install version 12 or later if necessary from nodejs.org.

  3. Use a version 12 or later release of node: nvm use xx.x.x (use the version you discovered in step 2).

  4. If you want to build the theme and run the Styleguide server, run yarn server:styleguide.

  5. If you want to build the theme without running the Styleguide server—

    • For the first build, run yarn cache clean && yarn && yarn format && yarn build.
    • For subsequent builds, run yarn build.

The build job creates and zips the theme in the directory build/ (see previous illustration). You can apply the built theme to a site; for details, see Changing a site's theme.