Skip to content

Commit 7ab9b4a

Browse files
authored
DEVDOCS-6658 Various fixes in Stencil docs (#1217)
# [DEVDOCS-6658] ## What changed? Various fixes in Stencil docs [DEVDOCS-6658]: https://bigcommercecloud.atlassian.net/browse/DEVDOCS-6658?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent ef2ee3e commit 7ab9b4a

30 files changed

+143
-143
lines changed

docs/storefront/stencil/cli/install.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ There are different options for installing Stencil CLI and its dependencies on a
2222
* Node.js 20+ (Stencil CLI supported version)
2323

2424
Note: If the Python version is more than 3.12, then you should install distutils using the following command:
25-
```pip install setuptools```
25+
`pip install setuptools`
2626

2727
To install Stencil CLI and its dependencies on Mac, open a terminal and run the following commands. For the latest `node` version supported, refer to [Stencil CLI README.MD](https://github.com/bigcommerce/stencil-cli).
2828

docs/storefront/stencil/cli/unexpected-behavior.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ stencil scss-autofix --dry
2929
3. To commit the changes and revalidate, run the following commands:
3030

3131
```shell showLineNumbers copy
32-
stencil scss-autofix
32+
stencil scss-autofix
3333
stencil bundle
3434
```
3535

@@ -58,7 +58,7 @@ Debug: internal, implementation, error
5858
(/usr/local/lib/node_modules/stencil-cli/server/plugins/CssCompiler/index.js:32:26)
5959
```
6060

61-
On MacOS, we have tested Stencil CLI most robustly on Node.js version 4.4.0. On Linux, we have tested most robustly on version 4.1.2. On Windows, we have tested most robustly on version 4.6.1. You’ll find detailed steps (for each operating system) in these instructions' Installing Stencil Prerequisites by OS section.
61+
On macOS, we have tested Stencil CLI most robustly on Node.js version 4.4.0. On Linux, we have tested most robustly on version 4.1.2. On Windows, we have tested most robustly on version 4.6.1. You’ll find detailed steps (for each operating system) in these instructions' Installing Stencil Prerequisites by OS section.
6262

6363
## npm install errors
6464

@@ -126,7 +126,7 @@ This error typically occurs when your `package.json` file includes an outdated v
126126

127127
### Running stencil bundle errors
128128

129-
Nowadays, `stencil bundle` runs several validation checks on a theme before it can be bundled and pushed to the store.
129+
Nowadays, `stencil bundle` runs several validation checks on a theme before it can be bundled and pushed to the store.
130130

131131
You may see those errors because your theme has some missing properties in its translations files or frontmatter that have recently become required.
132132

@@ -155,7 +155,7 @@ The following error indicates that there is a trailing comma in the frontmatter
155155
Error: Found unallowed trailing symbol in: "4,", while parsing frontmatter at ".....templates/pages/home.html".
156156
```
157157

158-
### Node support
158+
### Node support
159159

160160
When you update the Node.js version, you can check to see whether you can update other theme packages, such as webpack, for updated feature support.
161161

@@ -197,7 +197,7 @@ If you receive the same error again after running `npm install`, you should comp
197197

198198
## MacOS: Xcode/iOS license... errors
199199

200-
On MacOS, if you have recently installed a new version of Xcode, the command line will display the following error when you next try to use or reinstall Stencil:
200+
On macOS, if you have recently installed a new version of Xcode, the command line will display the following error when you next try to use or reinstall Stencil:
201201

202202
```text
203203
error: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
@@ -249,7 +249,7 @@ If executing the `stencil start` command generates an `Unauthorized, please use
249249

250250
### 403 errors
251251

252-
If the Stencil server responds with a `403` error and you are using a proxy-based domain service like Cloudflare or Amazon Cloudfront, modify your hosts file to map the localhost to your BigCommerce store IP address.
252+
If the Stencil server responds with a `403` error, and you are using a proxy-based domain service like Cloudflare or Amazon CloudFront, modify your hosts file to map the localhost to your BigCommerce store IP address.
253253

254254
## 500 errors
255255

docs/storefront/stencil/deployment/performance-optimization.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ When importing images, ensure your images are high quality, the appropriate dime
2727

2828
Injecting JavaScript context variables allow you to access store data through your theme. You can inject JavaScript context variables using the `{{inject}}` Handlebars helper. Be sure to assign a custom variable name to the injected variable.
2929

30-
You can then use the `{{jsContext}}` Handlebars helper to access a stringified JSON object containing all injected data with your assigned custom variable names as keys in the key-value pairs. For more information, see [injection helpers](/docs/storefront/stencil/themes/context/handlebars-reference#inject).
30+
You can then use the `{{jsContext}}` Handlebars helper to access a stringified JSON object containing all injected data with your assigned custom variable names as keys in the key-value pairs. For more information, see [injection helpers](/docs/storefront/stencil/themes/context/handlebars-reference#inject).
3131

32-
The code example below uses `{{inject}}` and `{{jsContext}}` to log the product name to your browser's console when added to Cornerstone's `product.html` file:
32+
The code example below uses `{{inject}}` and `{{jsContext}}` to log the product name to your browser's console when added to Cornerstone's `product.html` file:
3333

3434
```handlebars filename="product.html" showLineNumbers copy
3535
{{inject "myProductName" product.title}}
@@ -43,7 +43,7 @@ The code example below uses `{{inject}}` and `{{jsContext}}` to log the product
4343
</script>
4444
```
4545

46-
We recommend injecting only the variables you need. If you inject all settings, you could accidentlly inject PII (Personally-Identifying Information) and cause performance issues with your site.
46+
We recommend injecting only the variables you need. If you inject all settings, you could accidentally inject PII (Personally-Identifying Information) and cause performance issues with your site.
4747

4848
## Using Lighthouse
4949

@@ -59,7 +59,7 @@ Largest Contentful Paint (LCP) is the metric that reports the time it takes to d
5959

6060
<Callout type="info">
6161
#### Good score
62-
The optimal LCP score is 2.5 seconds or faster.
62+
The optimal LCP score is 2.5 seconds or faster.
6363
</Callout>
6464

6565
To improve LCP:
@@ -93,7 +93,7 @@ Cumulative Layout Shift (CLS) is the metric that measures visual stability. This
9393

9494
<Callout type="info">
9595
#### Good score
96-
The optimal CLS score is 0.1 seconds or less.
96+
The optimal CLS score is 0.1 seconds or less.
9797
</Callout>
9898

9999
To improve CLS:
@@ -108,7 +108,7 @@ In this example, the performance score is currently 47. The LCP score is 6.2 s,
108108

109109
![Performance Metrics](https://raw.githubusercontent.com/bigcommerce/dev-docs/master/assets/images/performance-example-1.png "Performance Metrics")
110110

111-
To improve performance, let's start by measuring usused JavaScript. In Chrome DevTools, the **Lighthouse** and **Coverage** tabs offer suggestions of unused JavaScript code that you can potentially remove. The red section of the bar represents unused bytes; the green section represents used bytes. It is important to note that unused JavaScript means your page has not used it yet. The JavaScript in red might be connected to event listeners that only fire when a user interacts with your page.
111+
To improve performance, let's start by measuring unused JavaScript. In Chrome DevTools, the **Lighthouse** and **Coverage** tabs offer suggestions of unused JavaScript code that you can potentially remove. The red section of the bar represents unused bytes; the green section represents used bytes. It is important to note that unused JavaScript means your page has not used it yet. The JavaScript in red might be connected to event listeners that only fire when a user interacts with your page.
112112

113113
![Coverage tab](https://raw.githubusercontent.com/bigcommerce/dev-docs/master/assets/images/performance-example-2.png "Coverage tab")
114114

@@ -117,7 +117,7 @@ In addition to removing unused code, you can minify, compress, and refactor CSS
117117
```css filename="Example, Part 1: Not minified" showLineNumbers copy
118118
.element-class {
119119
padding: 1px 5px 1px 5px;
120-
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
120+
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
121121
Bitstream Vera Sans Mono, Courier New, monospace, serif;
122122
background-color: #eeeeee;}
123123
```
@@ -128,14 +128,14 @@ background-color: #eeeeee;}
128128

129129
Lighthouse displays information relevant to elements contributing to the CLS score. In this example, the banner above the carousel causes a loading issue. Once the image is resized or removed the CLS score improves.
130130

131-
After removing some unused bytes, minifying JavaScript files, and resizing an image, the performance score is 77. The LCP score is now 4.3 s, the TBT score is 120 ms and the CLS score is 0.001. You can continue to remove additional unused bytes to improve your performance score and metrics.
131+
After removing some unused bytes, minifying JavaScript files, and resizing an image, the performance score is 77. The LCP score is now 4.3 s, the TBT score is 120 ms and the CLS score is 0.001. You can continue to remove additional unused bytes to improve your performance score and metrics.
132132

133133
![Improved Performance Metrics](https://raw.githubusercontent.com/bigcommerce/dev-docs/master/assets/images/performance-example-3.png "Improved Performance Metrics")
134134

135-
Using Lighthouse is an important step in optimizing your site and improving the user experience. It is an easy to use best practice tip that provides powerful insights.
135+
Using Lighthouse is an important step in optimizing your site and improving the user experience. It is an easy to use best practice tip that provides powerful insights.
136136

137137
## Using error detections and optimization tools
138-
Tools that automatically record errors and provide session playback and optimization suggestions often benefit from having access to the themes' source maps in production.
138+
Tools that automatically record errors and provide session playback and optimization suggestions often benefit from having access to the themes' source maps in production.
139139
They provide a way to translate between minified code, designed to decrease webpage load times and the source code the developer writes.
140140

141141
[Stencil CLI](/docs/storefront/stencil/cli/options-and-commands) provides convenient options for bundling the production-ready theme with source maps included.

docs/storefront/stencil/deployment/theme-images.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Displaying theme thumbnail images
66

77

8-
A complete Stencil theme includes screenshots to display the theme on cards that appear in two locations within a non active MSF BigCommerce control panel:
8+
A complete Stencil theme includes screenshots to display the theme on cards that appear in two locations within a non-active MSF BigCommerce control panel:
99

1010

1111
* **Storefront****Themes**: Each individual card displays a composite which is an image that contains combination of screenshots of the theme's multiple variations.

docs/storefront/stencil/deployment/upload-errors.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Troubleshooting Theme Uploads
22

3-
3+
44

55
## Restrictions
66

@@ -27,7 +27,7 @@ Custom theme uploads must meet these restrictions:
2727
| TR-800 | There was a problem processing the contained `config.json` file. Please check the `config.json` documentation for the required keys and for keys that require values. |
2828
| TR-900 | The contained `config.json` file is missing the required developer information. |
2929
| TR-901 | A theme variation defined in the contained config.json file is missing its required external ID. |
30-
| TR-902 | Two or more theme variations defined in the contained config.json file share an external ID. All external IDs must be unique. |
30+
| TR-902 | Two or more theme variations defined in the contained config.json file share an external ID. All external IDs must be unique. |
3131
| TR-1000 | There was a problem processing the contained <a href="https://github.com/bigcommerce/cornerstone/blob/master/schema.json">schema.json</a> file. |
3232
| TR-1001 | The theme is missing its required <a href="https://github.com/bigcommerce/cornerstone/blob/master/schema.json">schema.json</a> file. |
3333
| TR-1400 | There was a problem processing template <a href="/docs/storefront/stencil/themes/context/frontmatter">front matter</a>. |
@@ -63,6 +63,6 @@ Warnings will not block a theme's upload, but these onscreen and/or log messages
6363
## Workarounds and further info
6464
* When using a Windows machine, it is necessary to close PowerShell and re-open as admin before installing nvm.
6565

66-
* If a custom theme does not render properly after you upload and apply it to a storefront, make sure you have created the theme's zip file using the `stencil bundle` command, on a Mac OS, Linux computer, or virtual machine. Using the `stencil bundle` command will exclude Windows-specific errors that have occurred on some bundles.
66+
* If a custom theme does not render properly after you upload and apply it to a storefront, make sure you have created the theme's zip file using the `stencil bundle` command, on a macOS, Linux computer, or virtual machine. Using the `stencil bundle` command will exclude Windows-specific errors that have occurred on some bundles.
6767

6868
* If you repeatedly encounter the same error or warning and neither this page nor our KB resolves the problem, see support resources for theme developers in our [Developer Community](/community).

docs/storefront/stencil/draft/dynamic-content-rendering.mdx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Dynamic Content Rendering on Stencil Storefronts
3-
keywords: js, javascript, if,
3+
keywords: js, javascript, if,
44
---
55

66
# Dynamic Content Rendering on Stencil Storefronts
@@ -11,7 +11,7 @@ _We're gratefully sharing techniques devised by Ken Utting, Web Developer for Bi
1111

1212
At GORUCK, we've customized our Stencil theme (currently using the [Merchant](https://www.bigcommerce.com/theme/merchant-light/?_ga=2.52710120.1984523106.1539568940-967431010.1523308107) theme) to provide several ways to update our site content without requiring changes to the theme itself. This allows our content folks to make changes to our theme without having to wait on our software developers.
1313

14-
Also, by pushing content out of the theme, these techniques reduce the differences between our customized theme and the out-of-the-box (base) theme – which makes it easier to integrate ongoing updates into our theme. Finally, these techniques allow us share identical content across pages without copying and pasting.
14+
Also, by pushing content out of the theme, these techniques reduce the differences between our customized theme and the out-of-the-box (base) theme – which makes it easier to integrate ongoing updates into our theme. Finally, these techniques allow us to share identical content across pages without copying and pasting.
1515

1616
Three techniques in particular have proven useful to us. We call them Dropzones, Dynamic Tabs, and Snippets. There is nothing particularly special to GORUCK about these techniques, so there is no reason you can't adopt them for your own store/theme.
1717

@@ -104,8 +104,8 @@ In the example below, we use this technique to place the `RIGHT BY YOU` tab in t
104104
There are two versions of the HTML. The first is designed for a tab you want to drop in using a page's own HTML:
105105

106106
```handlebars showLineNumbers copy
107-
<div class="gr-tab" data-gr-position="POSITION" data-gr-title="TITLE">
108-
CONTENT
107+
<div class="gr-tab" data-gr-position="POSITION" data-gr-title="TITLE">
108+
CONTENT
109109
</div>
110110
```
111111

@@ -119,7 +119,7 @@ The second version is designed for a tab that gets its content from an external
119119
In this second case, the HTML in that external file must start with the POSITION and TITLE information:
120120

121121
```handlebars showLineNumbers copy
122-
<input id="gr-tab-data" type="hidden" data-gr-position="POSITION" data-gr-title="TITLE" />
122+
<input id="gr-tab-data" type="hidden" data-gr-position="POSITION" data-gr-title="TITLE" />
123123
CONTENT
124124
```
125125

@@ -153,37 +153,37 @@ Here are the contents of our `dynamicTab1.html` file:
153153
<div style="display: flex; flex-direction: column">
154154
<div style="display: flex">
155155
<div>
156-
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
156+
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
157157
src="https://content.goruck.com/2017site/products/free-returns-icon.png" height="auto"/>
158158
</div>
159159
<div>
160160
<h3 style="margin-top: 0">Free &amp; Easy Returns</h3>
161-
<p>Don't like it? Send it back for free. Returnable in like-new condition within 30 days and
161+
<p>Don't like it? Send it back for free. Returnable in like-new condition within 30 days and
162162
every order comes with a free return shipping label. Too easy.</p>
163163
</div>
164164
</div>
165165
166166
<div style="display: flex; margin-top: 12px">
167167
<div>
168-
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
168+
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
169169
src="https://content.goruck.com/2017site/products/challenge-excellence.png" height="auto"/>
170170
</div>
171171
172172
<div>
173173
<h3 style="margin-top: 0">Challenge Excellence</h3>
174-
<p>We have two grades, A and F and A- rounds down. Excellence is the standard and please hold us to it,
174+
<p>We have two grades, A and F and A- rounds down. Excellence is the standard and please hold us to it,
175175
we want you to love your gear as much as we do.</p>
176176
</div>
177177
</div>
178178
179179
<div style="display: flex; margin-top: 12px">
180180
<div>
181-
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
181+
<img style="display: block; width: 100px; max-width: 100px; margin-right: 24px"
182182
src="https://content.goruck.com/2017site/products/customer-service-icon.png" height="auto"/>
183183
</div>
184184
<div>
185185
<h3 style="margin-top: 0">Do Right By People</h3>
186-
<p>Our goal is to run a company our grandfathers would be proud of. And the central tenet
186+
<p>Our goal is to run a company our grandfathers would be proud of. And the central tenet
187187
&mdash; an oldie but a goodie &mdash; is that we do whatever it takes to do right by people.
188188
Contact us at <a href="https://goruck.zendesk.com/hc/en-us/requests/new" target="_blank">
189189
team@goruck.com</a> with any questions and we'll get back to you ASAP.</p>
@@ -193,7 +193,7 @@ Here are the contents of our `dynamicTab1.html` file:
193193
</div>
194194
```
195195

196-
### Dynamic Tabs JavaScript
196+
### Dynamic Tabs JavaScript
197197

198198
Again, the JavaScript code to implement Dynamic Tabs is invoked in the PageManager class' before method. The Dynamic Tabs code is more complex, and it relies on other classes we wrote to get content from the external server and cache it in the browser.
199199

@@ -225,7 +225,7 @@ The external file can contain any arbitrary HTML and CSS, and the styled HTML is
225225

226226
Like Dropzones and Dynamic Tabs, the Snippets code is invoked in `PageManager`'s `before` method. Snippets adds just another 50 lines of JavaScript code to the theme, also relying on the same code that Dynamic Tabs uses to get the external file and cache it in the browser.
227227

228-
## Recap
228+
## Recap
229229

230230
At GORUCK, we've developed a number of techniques that allow us to separate our content from our theme. These techniques have proved valuable to us, because they allow us to:
231231

0 commit comments

Comments
 (0)