Skip to content

Commit b5776cc

Browse files
authored
Merge pull request #711 from primer/fix-storybook-again
Fix storybook, post-sync
2 parents fadc008 + 77bfeae commit b5776cc

File tree

7 files changed

+15
-22
lines changed

7 files changed

+15
-22
lines changed

.storybook/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ addParameters({
3939
})
4040

4141
configure(() => {
42-
const loadMarkdown = require.context('../src', true, /\.md$/)
42+
const loadMarkdown = require.context('../pages/css', true, /\.md$/)
4343
for (const path of loadMarkdown.keys()) {
4444
loadMarkdown(path)
4545
}

.storybook/preview-head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<link rel="stylesheet" href="https://unpkg.com/octicons@7.0.1/build/build.css">
1+
<link rel="stylesheet" href="https://unpkg.com/octicons@8.5.0/build/build.css">
22
<script src="https://github.com/site/assets/styleguide.js" async></script>

.storybook/story-loader.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-console */
2-
const {dirname} = require('path')
2+
const {basename, dirname, join} = require('path')
33
const parseFromString = require('code-blocks/lib/fromString')
44

55
module.exports = function storyLoader(markdown) {
@@ -15,11 +15,7 @@ module.exports = function storyLoader(markdown) {
1515

1616
// strip the sourcePath from the beginning of the resourcePath
1717
const file = resourcePath.replace(`${sourcePath}/`, '')
18-
// finally, remove "/README" or "/docs" from the path,
19-
// then strip the ".md" filename extension
20-
const path = dirname(file)
21-
.replace(/(\/README|\/docs)/, '')
22-
.replace(/\.md$/, '')
18+
const path = join(dirname(file), basename(file, '.md'))
2319

2420
const stories = storiesFromMarkdown(markdown, file)
2521
if (stories.length) {

.storybook/webpack.config.js

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
const {resolve} = require('path')
2-
const sourcePath = resolve(__dirname, '../src')
2+
const pagesPath = resolve(__dirname, '../pages/css')
33

44
module.exports = ({config}) => {
5-
const babel = config.module.rules.find(rule => {
6-
return rule.test.test('test.js')
7-
}).use[0]
5+
const babel = config.module.rules[0].use[0]
86

97
config.module.rules = config.module.rules.filter(rule => {
108
return !rule.test.test('test.md')
@@ -13,20 +11,19 @@ module.exports = ({config}) => {
1311
config.module.rules.push(
1412
{
1513
test: /\.md$/,
16-
include: sourcePath,
14+
include: pagesPath,
1715
loaders: [
1816
babel,
1917
{
2018
loader: require.resolve('./story-loader'),
2119
options: {
22-
sourcePath
20+
sourcePath: pagesPath
2321
}
2422
}
2523
]
2624
},
2725
{
2826
test: /\.scss$/,
29-
include: sourcePath,
3027
loaders: [
3128
'style-loader',
3229
'css-loader',

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pages/css/getting-started/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ $blue: #0000ff;
7777

7878
Don't forget to add the compiled CSS to the `<head>` section of your page.
7979

80-
```html dead
80+
```html inert=true
8181
<link href="path/to/style.css" rel="stylesheet">
8282
```
8383

8484
## Using primer on a static site
8585

8686
You won't need to install any node modules for a static site, you can use the built CSS. The best thing to do is to [download the built CSS](https://unpkg.com/primer/build/build.css) from the npm module and host it yourself. If that's not an option, you can include a CDN link in your html:
8787

88-
```html dead
88+
```html inert=true
8989
<link href="https://unpkg.com/primer/build/build.css" rel="stylesheet">
9090
```

pages/css/principles/html.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ title: HTML
1515
* Avoid trailing slashes in self-closing elements. For example, `<br>`, `<hr>`, `<img>`, and `<input>`.
1616
* Don't set `tabindex` manually—rely on the browser to set the order.
1717

18-
```html dead={true}
18+
```html inert=true
1919
<p class="line-note m-0" data-attribute="106">
2020
This is my paragraph of special text.
2121
</p>
@@ -25,7 +25,7 @@ title: HTML
2525

2626
Many attributes don't require a value to be set, like `disabled` or `checked`, so don't set them.
2727

28-
```html dead={true}
28+
```html inert=true
2929
<input type="text" disabled>
3030

3131
<input type="checkbox" value="1" checked>
@@ -41,7 +41,7 @@ For more information, [read the WhatWG section](http://www.whatwg.org/specs/web-
4141

4242
Whenever possible, avoid superfluous parent elements when writing HTML. Many times this requires iteration and refactoring, but produces less HTML. For example:
4343

44-
```html dead={true}
44+
```html inert=true
4545
<!-- Not so great -->
4646
<span class="avatar">
4747
<img src="https://github.com/github.png">
@@ -62,7 +62,7 @@ Whenever possible, avoid superfluous parent elements when writing HTML. Many tim
6262

6363
Make use of `<thead>`, `<tfoot>`, `<tbody>`, and `<th>` tags (and `scope` attribute) when appropriate. (Note: `<tfoot>` goes above `<tbody>` for speed reasons. You want the browser to load the footer before a table full of data.)
6464

65-
```html dead={true}
65+
```html inert=true
6666
<table summary="This is a chart of invoices for 2011.">
6767
<thead>
6868
<tr>

0 commit comments

Comments
 (0)