{"id":13701001,"url":"https://github.com/bigcommerce/cornerstone","last_synced_at":"2026-01-02T11:57:23.953Z","repository":{"id":31122538,"uuid":"34682093","full_name":"bigcommerce/cornerstone","owner":"bigcommerce","description":"The BigCommerce Cornerstone theme","archived":false,"fork":false,"pushed_at":"2024-10-29T09:21:50.000Z","size":43226,"stargazers_count":286,"open_issues_count":192,"forks_count":609,"subscribers_count":59,"default_branch":"master","last_synced_at":"2024-10-29T11:38:16.419Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://developer.bigcommerce.com/stencil-docs","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigcommerce.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-27T17:58:18.000Z","updated_at":"2024-10-29T09:21:53.000Z","dependencies_parsed_at":"2023-01-14T18:30:35.363Z","dependency_job_id":"fb12852a-be84-492a-86f6-25d3812e0fe6","html_url":"https://github.com/bigcommerce/cornerstone","commit_stats":null,"previous_names":[],"tags_count":264,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fcornerstone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fcornerstone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fcornerstone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigcommerce%2Fcornerstone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigcommerce","download_url":"https://codeload.github.com/bigcommerce/cornerstone/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240415212,"owners_count":19797599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T20:01:13.740Z","updated_at":"2026-01-02T11:57:23.941Z","avatar_url":"https://github.com/bigcommerce.png","language":"HTML","funding_links":[],"categories":["HTML"],"sub_categories":[],"readme":"# Cornerstone\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/bigcommerce/cornerstone)\n![tests](https://github.com/bigcommerce/cornerstone/workflows/Theme%20Bundling%20Test/badge.svg?branch=master)\n\nStencil's Cornerstone theme is the building block for BigCommerce theme developers to get started quickly developing premium quality themes on the BigCommerce platform.\n\n### Stencil Utils\n[Stencil-utils](https://github.com/bigcommerce/stencil-utils) is our supporting library for our events and remote interactions.\n\n## JS API\nWhen writing theme JavaScript (JS) there is an API in place for running JS on a per page basis. To properly write JS for your theme, the following page types are available to you:\n\n* \"pages/account/addresses\"\n* \"pages/account/add-address\"\n* \"pages/account/add-return\"\n* \"pages/account/add-wishlist\"\n* \"pages/account/recent-items\"\n* \"pages/account/download-item\"\n* \"pages/account/edit\"\n* \"pages/account/return-saved\"\n* \"pages/account/returns\"\n* \"pages/account/payment-methods\"\n* \"pages/auth/login\"\n* \"pages/auth/account-created\"\n* \"pages/auth/create-account\"\n* \"pages/auth/new-password\"\n* \"pages/blog\"\n* \"pages/blog-post\"\n* \"pages/brand\"\n* \"pages/brands\"\n* \"pages/cart\"\n* \"pages/category\"\n* \"pages/compare\"\n* \"pages/errors\"\n* \"pages/gift-certificate/purchase\"\n* \"pages/gift-certificate/balance\"\n* \"pages/gift-certificate/redeem\"\n* \"global\"\n* \"pages/home\"\n* \"pages/order-complete\"\n* \"pages/page\"\n* \"pages/product\"\n* \"pages/search\"\n* \"pages/sitemap\"\n* \"pages/subscribed\"\n* \"pages/account/wishlist-details\"\n* \"pages/account/wishlists\"\n\nThese page types will correspond to the pages within your theme. Each one of these page types map to an ES6 module that extends the base `PageManager` abstract class.\n\n```javascript\n    export default class Auth extends PageManager {\n        constructor() {\n            // Set up code goes here; attach to internals and use internals as you would 'this'\n        }\n    }\n```\n\n### JS Template Context Injection\nOccasionally you may need to use dynamic data from the template context within your client-side theme application code.\n\nTwo helpers are provided to help achieve this.\n\nThe inject helper allows you to compose a JSON object with a subset of the template context to be sent to the browser.\n\n```\n{{inject \"stringBasedKey\" contextValue}}\n```\n\nTo retrieve the parsable JSON object, just call `{{jsContext}}` after all of the `{{@inject}}` calls.\n\nFor example, to setup the product name in your client-side app, you can do the following if you're in the context of a product:\n\n```html\n{{inject \"myProductName\" product.title}}\n\n\u003cscript\u003e\n// Note the lack of quotes around the jsContext handlebars helper, it becomes a string automatically.\nvar jsContext = JSON.parse({{jsContext}}); // jsContext would output \"{\\\"myProductName\\\": \\\"Sample Product\\\"}\" which can feed directly into your JavaScript\n\nconsole.log(jsContext.myProductName); // Will output: Sample Product\n\u003c/script\u003e\n```\n\nYou can compose your JSON object across multiple pages to create a different set of client-side data depending on the currently loaded template context.\n\nThe stencil theme makes the jsContext available on both the active page scoped and global PageManager objects as `this.context`.\n\n## Polyfilling via Feature Detection\nCornerstone implements [this strategy](https://philipwalton.com/articles/loading-polyfills-only-when-needed/) for polyfilling.\n\nIn `templates/components/common/polyfill-script.html` there is a simple feature detection script which can be extended to detect any recent JS features you intend to use in your theme code.\n\nIf any one of the conditions is not met, an additional blocking JS bundle configured in `assets/js/polyfills.js` will be loaded to polyfill modern JS features before the main bundle executes. \n\nThis intentionally prioritizes the experience of the 90%+ of shoppers who are on modern browsers in terms of performance, while maintaining compatibility (at the expense of additional JS download+parse for the polyfills) for users on legacy browsers.\n\n## Static assets\nSome static assets in the Stencil theme are handled with Grunt if required. This\nmeans you have some dependencies on grunt and npm. To get started:\n\nFirst make sure you have Grunt installed globally on your machine:\n\n```\nnpm install -g grunt-cli\n```\n\nand run:\n\n```\nnpm install\n```\n\nNote: package-lock.json file was generated by Node version 20 and npm version 10. The app supports Node 20 as well as multiple versions of npm, but we should always use those versions when updating package-lock.json, unless it is decided to upgrade those, and in this case the readme should be updated as well. If using a different version for node OR npm, please delete the package-lock.json file prior to installing node packages and also prior to pushing to github.\n\nIf updating or adding a dependency, please double check that you are working on Node version 20 and npm version 10 and run ```npm update \u003cpackage_name\u003e```  or ```npm install \u003cpackage_name\u003e``` (avoid running npm install for updating a package). After updating the package, please make sure that the changes in the package-lock.json reflect only the updated/new package prior to pushing the changes to github.\n\n\n### Icons\nIcons are delivered via a single SVG sprite, which is embedded on the page in\n`templates/layout/base.html`. It is generated via a grunt task `grunt svgstore`.\n\nThe task takes individual SVG files for each icon in `assets/icons` and bundles\nthem together, to be inlined on the top of the theme, via an ajax call managed\nby svg-injector. Each icon can then be called in a similar way to an inline image via:\n\n```\n\u003csvg\u003e\u003cuse xlink:href=\"#icon-svgFileName\" /\u003e\u003c/svg\u003e\n```\n\nThe ID of the SVG icon you are calling is based on the filename of the icon you want,\nwith `icon-` prepended. e.g. `xlink:href=\"#icon-facebook\"`.\n\nSimply add your new icon SVG file to the icons folder, and run `grunt svgstore`,\nor just `grunt`.\n\n#### License\n\n(The MIT License)\nCopyright (C) 2015-present BigCommerce Inc.\nAll rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fcornerstone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigcommerce%2Fcornerstone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigcommerce%2Fcornerstone/lists"}