In this tutorial we’ll walk through a basic stencil CLI installation on Windows downloading the base theme cornerstone and initializing and launching the CLI full documentation on these installation instructions can be found on our stencil developer portal.
Before you can install the stencil CLI there are some dependencies you must have first you do need to have admin permission on your computer next you must have a Git client for this installation my Git client came from Git – SCM comm the install comes with Git bash which is in a requirement but does give some command-line enhancements after that you’ll need to have no GAF please refer to the documentation for the current recommended version.
In addition you’ll need to install Python 2.7 dot X you will also need to install Visual Studio 2013 the Community Edition is flying here you may use a newer version like 2015 but that will require a custom installation to get the C++ compiler this is why we recommend 2013 instead once you’ve got all the dependencies covered installing the CLI is simple I’m going to pull up bash and use the following command during the installation you may see warnings about deprecation of the good reporter interface you can safely ignore this and other warnings after the CLI finishes installing.
You’ll want to clone the base cornerstone theme to your local environment in bash navigate to whichever directory you want to install the base theme in then use the following command to clone the theme to your chosen directory.
Next NPM must be used to install the stencil utils module in the field you’ll want to navigate into the theme directory that are in the following command keep in mind if you clone a new version of cornerstone at a later date you must rerun this command in the new theme directory before stencil can be initialized in API account needs to be created on the Bigcommerce store that you will be developing for to do this log into the stores control panel and navigate to advanced settings API accounts.
Currently only store owners have access to this area of the control panel click the option in the upper left create API account add a user name I just use stencil on this then set your scenes scope read-only lets you connect to the store with browser sync so you can see how changes will look on the live storefront using the modify scope will allow you to apply themes to the store using the command-line interface I’ll set modify as my scope as we’ll be using this in a later post then I’ll hit save once it’s saved you’ll get a pop-up window with your client ID and access token.
You’ll need these to initialize stencil also a text file will be downloaded so you have a copy of these credentials once you click done you won’t be able to view the token information again so keep the text file in a safe location now that the API account has been created stencil can be initialized in bash you should still be within the theme directory from there use the command stencil in it.
It should now prompt you for the home page URL for the store you’re going to be developing against locally go ahead and enter the URL next it’ll ask you for the port you’d like to run the store on it defaults to 3,000 which is what we recommend next it’s going to ask you for your API credentials.
First you’ll need the client ID then the access token once all those are entered you should get a confirmation that stencil is initialized from here you can run stencil using the stencil start command once it’s started you can see a list of URLs to access the local store including external URLs you can use for testing on other devices here I’ll use localhost 3000 in another browser tab I can now see what the production store would look like with this locally installed stencil being in the next set of posts we’ll take a deeper look at making customizations to a stencil theme using the CLI or contact us now if you need help with installing stencil CLI for Windows.