mirror of
https://github.com/tachyons-css/tachyons.git
synced 2026-02-06 13:56:46 +00:00
Dynamically grab readme docs from src css
This commit is contained in:
parent
102e13c44d
commit
4c95f5d2f1
9
docs/build/modules.js
vendored
9
docs/build/modules.js
vendored
@ -9,12 +9,8 @@ const px = Object.keys(dependencies)
|
||||
.filter(m => !/^tachyons-(colors|generator|styles|component-loader)/.test(m))
|
||||
.map(async m => {
|
||||
const pkg = require(`${m}/package.json`)
|
||||
const readme = readFileSync(
|
||||
path.resolve('node_modules', m, 'readme.md'),
|
||||
'utf8'
|
||||
)
|
||||
const src = readFileSync(
|
||||
path.resolve('node_modules', m, 'src', `${m}.css`),
|
||||
path.resolve('..', 'src', `_${m.replace(/^tachyons-/, '')}.css`),
|
||||
'utf8'
|
||||
)
|
||||
const css = readFileSync(
|
||||
@ -22,6 +18,9 @@ const px = Object.keys(dependencies)
|
||||
'utf8'
|
||||
)
|
||||
|
||||
const docsComment = src.match(/\/\*!!!([\S\s]*?)\*\//m)
|
||||
const readme = docsComment && docsComment[0].replace(/^\/\*!!!/, '').replace(/\*\/$/, '')
|
||||
|
||||
const tableOfStyles = await cssTable(css, { from: m })
|
||||
|
||||
return {
|
||||
|
||||
27
docs/package-lock.json
generated
27
docs/package-lock.json
generated
@ -2033,11 +2033,33 @@
|
||||
"resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz",
|
||||
"integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=",
|
||||
"requires": {
|
||||
"globby": "6.1.0",
|
||||
"is-path-cwd": "1.0.0",
|
||||
"is-path-in-cwd": "1.0.0",
|
||||
"p-map": "1.2.0",
|
||||
"pify": "3.0.0",
|
||||
"rimraf": "2.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"globby": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz",
|
||||
"integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=",
|
||||
"requires": {
|
||||
"array-union": "1.0.2",
|
||||
"glob": "7.1.2",
|
||||
"object-assign": "4.1.1",
|
||||
"pify": "2.3.0",
|
||||
"pinkie-promise": "2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"pify": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
|
||||
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delayed-stream": {
|
||||
@ -7844,11 +7866,6 @@
|
||||
"resolved": "https://registry.npmjs.org/tachyons-widths/-/tachyons-widths-5.2.1.tgz",
|
||||
"integrity": "sha512-LrqK5D8pH1K5JPrv1ld2o+oybDzvhq4dIEW43u3RpyPYg2PizUnxdKWm+QREsOWDDGgwwOMi094P6y5yoBSDNw=="
|
||||
},
|
||||
"tachyons-word-break": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/tachyons-word-break/-/tachyons-word-break-3.0.4.tgz",
|
||||
"integrity": "sha1-JC/vWMFlC5mINMpfZ/If/1b/oRg="
|
||||
},
|
||||
"tachyons-z-index": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/tachyons-z-index/-/tachyons-z-index-1.0.9.tgz",
|
||||
|
||||
@ -86,7 +86,6 @@
|
||||
"tachyons-visibility": "^2.0.5",
|
||||
"tachyons-white-space": "^4.0.6",
|
||||
"tachyons-widths": "^5.2.1",
|
||||
"tachyons-word-break": "^3.0.4",
|
||||
"tachyons-z-index": "^1.0.9"
|
||||
},
|
||||
"contributors": [
|
||||
|
||||
@ -2,7 +2,6 @@ import React, { Component } from 'react'
|
||||
import Highlight from 'react-highlight'
|
||||
|
||||
import Layout from '../ui/Layout'
|
||||
import Doc from '../tmp.md'
|
||||
import SrcReference from '../ui/SrcReference'
|
||||
import { Flex, md } from '../ui'
|
||||
import { modules } from '../ui/data.json'
|
||||
@ -35,7 +34,7 @@ class Reference extends Component {
|
||||
</div>
|
||||
<Flex className='ml6 pl6 w-100 mh-100'>
|
||||
<div className='flex-1 pa3 pv4'>
|
||||
<Doc components={md} />
|
||||
<Highlight>{module.readme}</Highlight>
|
||||
</div>
|
||||
<div className='flex-1'>
|
||||
<SrcReference {...module} />
|
||||
|
||||
@ -32,7 +32,6 @@ export default ({
|
||||
|
||||
{skipHeader ? null : <Header version={version} />}
|
||||
<main className={className} children={children} />
|
||||
<Footer />
|
||||
{skipFooter ? null : <Footer />}
|
||||
</div>
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user