To install Stencil CLI on windows, initially download the following in your PC:
*Git
*Python 2.7.x or python 3.11
*node .js 14 and npm (higher versions are not supported)
Once these are installed, use the following command in command prompt to download Stencil CLI:
npm install -g @bigcommerce/stencil-cli
Live preview of theme
- Add API account
Go to your Bigcommerce store -> Control panel -> settings -> API account -> Create API account -> Select stencil CLI token -> Give theme permission as publish -> save
Make sure to note down the url and token number when the API account is created.
- Download theme
To download the Big Commerce Cornerstone theme, type the following command in gitbash:
git clone https://github.com/bigcommerce/cornerstone.git
- Install theme modules
It is important to download npm modules to properly leverage stencil framework:
cd ~/path/to/theme/dir
npm install
- Serving live preview
Open the Cornerstone theme file and open command prompt in it or change directory to them files directory.
stencil init –url https://yourstore.com/ –token 19d3ae6-dc15-4af9-bead-a2c703aa7b –port 3000
(Copy the url and access token you have copied earlier during creation of API account and paste in above command.
port number can be any free port number.)
stencil start
This will give an output like this:
Local: http://localhost:3000
Copy this url to any browser and you can see your live Big Commerce store in it.
- Using Xampp
If you are not able to view the store in local host or getting an error like “local host refused to connect”, do the following:
- Download Xampp
Make sure you are turning off windows defender or uninstalling any anti virus program running on your system before downloading Xampp
2. Install Xampp
After installing, in Xampp control panel start sql and apache
The engaged ports can be seen near apache(make sure you are not specifying that port)
3. Open Xampp file
Open htdocs folder in Xampp file. Move cornerstone folder into htdocss.
4. Run commands in command prompt
stencil init –url https://yourstore.com/ –token 19d3ae6-dc15-4af9-bead-a2c703aa7b –port 3000
stencil start
5. Open browser and run the local host url