Installing Stencil CLI for Linux – Bigcommerce Tutorial :)

In this tutorial we’ll walk through a basic installation of stencil command-line interface on linux using ubuntu 16.04 we’ll also cover downloading the base theme cornerstone and initializing and launching the CLI full documentation on these instructions can be found on our stencil developer portal.

Before you can install the CLI there are some dependencies that you must have first you do need to have root permissions on your computer if you don’t have root permissions you may need to run installation commands with the sudo prefix.

Next you will need a Git client my Linux distro came with Git installed but if yours did not you should be able to find installation instructions for your distro at Git – FCM dot-com after that you’ll need to have no js’.

We recommend using nvm for installing node please check the stencil documentation for the current recommended version once you’ve got the dependencies covered installing the CLI is simple I’m going to pull up terminal and use the following command during the installation you may see warnings about deprecation of the good reporter interface or other components you can safely ignore these warnings after to CLI finishes installing you want to clone the base cornerstone game into your local environment in terminal navigate to whichever directory you want to install the base theme in then use the following command to clone that into your chosen directory.

Next you must use NPM to add the stencil utils Java Script utilities to the theme you’ll want to navigate into the theme directory then run 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 an 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 an API account add a user name I just use stencil then set your theme 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 use this in a later posts then I’ll save once you hit save you’ll get a pop-up window with your client ID and access token you’ll want to save these for when we initialize stencil a text file will also be downloaded so you have a copy of the credentials once you click done you won’t be able to view the token information again.

So keep the txt file in a safe location now that the API account has been created stencil can be initialized in terminal you should still be within the theme directory from here use the command stencil in 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 will 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 launch return using these stencils start command once it’s started you can see a list of URLs to access the local store including external URLs can use for testing on other devices here I’ll use localhost 3000 in a browser tab or contact us now if you need help with installing stencil CLI for linux.

By KrishnaDasa

A shri krishna dasa devotee, follower of Shrimad Bhagavad gita, Shrimad Bhagavatam and a member of Iskcon Bhopal.

Leave a Reply

Your email address will not be published. Required fields are marked *