CCD-102 practice question 19 of 30

In order to build the SFRA code to a developer sandbox for the first time, which build steps should the developer perform for the site to appear and function as designed?

Full set: 206 questions
Answer options
A: npm run compile:js, npm run compile:html, npm run clean
B: npm run compile:scss, npm run compile:html, npm run clean
C: npm run compile:js, npm run compile: scss, npm run compile:html
D: npm run compile:js, npm run compile:scss, npm run compile:fonts Correct answer
Correct Answer:
D. npm run compile:js, npm run compile:scss, npm run compile:fonts
Explanation

To build the Storefront Reference Architecture (SFRA) for the first time, the developer must compile all necessary front-end assets. The npm run compile:js script compiles the JavaScript files required for site functionality and interactivity. The npm run compile:scss script compiles the SASS files into CSS for styling and visual appearance. The npm run compile:fonts script processes the font files necessary for the site's typography. These three commands, often bundled into a single npm run build command, ensure the storefront appears and functions as designed.

References

1. Salesforce Developers Documentation

Set Up the Storefront Reference Architecture: The setup guide outlines the build process. The build command is a composite of the individual compile tasks. The documentation states

"To compile your code and upload it to the server

you can run the npm run build command." The underlying scripts that constitute the build are for JS

SCSS

and other assets like fonts.

Reference: Salesforce B2C Commerce Developer Documentation

"Set Up Your Local SFRA Environment" section.

2. Official SFRA GitHub Repository

package.json: The package.json file in the root of the official storefront-reference-architecture repository explicitly defines the build scripts. The main build script is defined as: "build": "npm run compile:js && npm run compile:scss && npm run compile:fonts". This directly confirms that these three compilation steps are the required components for a standard build.

Reference: package.json

scripts object

in the main branch of the salesforce/storefront-reference-architecture GitHub repository.

3. Salesforce Trailhead

Develop for Salesforce B2C Commerce: The "Customize the Storefront" module explains the asset compilation process. It details how JavaScript and CSS (compiled from SCSS) are bundled and uploaded to the sandbox

which is accomplished via the npm build scripts.

Reference: Salesforce Trailhead

"Salesforce B2C Commerce SFRA" trail

"Customize the Storefront" module.

Scroll to Top