Build SFRA
Build SFRA and upload code to your sandbox. If a cartridge has style sheets or JavaScript, compile it before uploading.
Building a Cartridge
To compile the style sheets and JavaScript for a cartridge:
- Open a command-line terminal.
- Navigate to the top-level folder of the repository containing the cartridges directory,
such as
storefront-reference-architecture. -
To compile both CSS and JavaScript, enter:
npm run compile:js && npm run compile:scss && npm run compile:fontsTo compile only CSS:npm run compile:scssTo compile only JavaScript:npm run compile:jsNote: Usually, you only have to compile fonts once.
Build Commands
The build commands are defined in the scripts section of the
package.json for your top-level folder. You can change the commands and
add commands for other command-line tools in the package.json file.
If you have installed the
sgmf-scripts node globally, use this command to see all
current build commands:
sgmf-scripts --help
If
you have installed the
sgmf-scripts node locally, use
this command to see all current build commands:
node node_modules/sgmf-scripts --helpYou
can customize the build commands or add new ones in your
package.json. See npm documentation for more information
about adding scripts for npm.
Building the JSDoc
To build an HTML version of the JSDoc:
- Clone or download the sfra-jsdoc repository from GitHub.
- Read the ReadMe for the most up-to-date instructions on how to configure and run the repository.