Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <ul id="container" class="cf"></ul>

<script id="ourTemplate" type="text/x-handlebars-template">
  {{#each this}}
  <li class='product-container'>
    <div class="product-link">
      <a href="{{ url }}" target="_blank">{{ name }}</a>
    <div class='img-container'>
      <img src=" {{ thumbnail }} ">
    <div>Number in stock: {{ stock.stockLevel }}</div>
    <div class='price-container'>Price: {{ priceData.formattedPriceWithoutDecimals }}</div>


                * {
  box-sizing: border-box;
.cf:after {
    content: " ";
    display: table;

.cf:after {
    clear: both;

ul#container {
  width: 100%;
  margin: 0 0 20px 0;
  list-style-type: none;
  padding: 0;
li.product-container {
  float: left;
  width: 50%;
  height: 255px;
  text-align: center;
  outline: 1px solid #ccc;
  padding: 10px;

/*  Tablet View  */
@media (min-width: 43.563em) and (max-width: 63.25em) {
  width: 25%;

/*  Desktop View  */
@media (min-width: 63.25em) {
  width: 20%;
.img-container {
  display: block;
  margin: 10px auto;
.product-link a {
  color: #6D92AD;
  text-decoration: none;
.price-container {
  font-weight: bold;
  margin: 8px 0 0;
  color: #776D5A;



                const url = ",1181918,1188952,1186721,1186396,1177398,1217459,1177486,1186168,1177405,1184983";

.then(function(response) {
  if (!response.ok) {
    throw Error(response.statusText);
  // Read the response as json.
  return response.json();
.then(function(response) { 
  // Do stuff with the JSON
  // console.log(response);
.catch(function(error) {
  console.log('Looks like there was a problem: \n', error);

// Function to generate the HTML
function createHtml(ourData) { // ourData is just a parameter and can be named anything
  let rawTemplate = document.querySelector("#ourTemplate").innerHTML;
  let compiledTemplate = Handlebars.compile(rawTemplate);
  let ourGeneratedHTML = compiledTemplate(ourData);
  let ourContainer = document.querySelector("#container");
  ourContainer.innerHTML = ourGeneratedHTML;