From 63b24f42d4aea3579a16885a5205e734bc4194ac Mon Sep 17 00:00:00 2001 From: Brian Hough Date: Sat, 26 Aug 2017 11:40:38 -0700 Subject: [PATCH] fix(Docs): Remove redundant TOC from README and add TypeScript section. (#237) * fix(Docs): Remove redundant TOC from README and add TypeScript section. * docs(Remove unneeded markdown.js theme script): --- README.md | 107 ++----------------------------- docs-theme/markdown.js | 39 ------------ docs/assets/polished.js | 3 +- docs/docs/index.html | 136 ++++++++++++++++++++-------------------- package.json | 3 +- 5 files changed, 76 insertions(+), 212 deletions(-) delete mode 100644 docs-theme/markdown.js diff --git a/README.md b/README.md index af4e2971..c0d9377c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ Want to write styles in JavaScript, but also want Sass-style helper functions an - **Cross framework compatible**: No matter if you're using `styled-components`, aphrodite, radium, or plain inline styles, as long as you're writing your styles in JavaScript you can use polished! - **Switching from a pre-processor to styles in JS made easy** +## Docs + +**See the full documentation at [polished.js.org](http://polished.js.org/docs)!** + ## Usage `✨ polished` modules are meant to be used as stand-alone imports. You should avoid importing the entire library directly: @@ -42,9 +46,9 @@ Flow frequently updates and it is possible that the version you are running may .*/node_modules/polished/.* ``` -## Docs +## TypeScript -**See the full documentation at [polished.js.org](http://polished.js.org/docs)!** +`✨ polished` has [TypeScript](https://www.typescriptlang.org/) definitions to allow the library to be used in any TypeScript project. ### Babel plugin @@ -54,105 +58,6 @@ You can optionally also use [`babel-plugin-polished`](https://github.com/styled- In the documentation you will see examples using [object spread properties](https://github.com/tc39/proposal-object-rest-spread). (`{ ...other }`) To enable this syntax in your project add the [`transform-object-rest-spread` plugin](https://www.npmjs.com/package/babel-plugin-transform-object-rest-spread) (or the [`stage-3` preset](https://babeljs.io/docs/plugins/preset-stage-3/) to enable all stage three features) to your Babel configuration. -### ToC - - - -
- Mixins - -
-
- Color - -
-
- Shorthands - -
-
- Helpers - -
-
- Types - -
- - ## Why? When writing styles in JavaScript, many people need Sass-style helper functions to be productive. `✨ polished` brings them to you in a nice, lightweight package tailor-made for styles in JavaScript. diff --git a/docs-theme/markdown.js b/docs-theme/markdown.js deleted file mode 100644 index 3539f0cd..00000000 --- a/docs-theme/markdown.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Theme for documentation.js, which injects the ToC of the real docs into the README. Note: This is - * hacky, as this is meant for HTML themes, but it works! - */ -const fs = require('fs') -const path = require('path') -const GithubSlugger = require('github-slugger') - -const slugger = new GithubSlugger() -const isHeading = (comment) => comment.kind === 'note' -const DOCS_SECTION = /()(.|\n)+()/gi -const createLink = (text, slug) => `${text}` - -module.exports = (comments, options, callback) => { - // Create the ToC to be injected into the README - let firstNote = true - const toc = comments - .filter(comment => comment.markdown !== false) - .map(comment => { - const slug = slugger.slug(comment.name) - if (isHeading(comment)) { - let prepend = ' \n\n' - // The first note does not need to prepend - if (firstNote) { - firstNote = false - prepend = '' - } - return `${prepend}
\n ${comment.name}\n \n
\n`) - fs.writeFileSync(path.resolve('README.md'), newReadme) - callback(null, []) -} diff --git a/docs/assets/polished.js b/docs/assets/polished.js index 5ea4c757..1bc31bde 100644 --- a/docs/assets/polished.js +++ b/docs/assets/polished.js @@ -181,7 +181,7 @@ var pxtoFactory$1 = function pxtoFactory$1(to) { */ // Don’t inline this variable into export because Rollup will remove the /*#__PURE__*/ comment -var em = /*#__PURE__*/pxtoFactory$1('em'); // eslint-disable-line spaced-comment +var em = /* #__PURE__*/pxtoFactory$1('em'); // eslint-disable-line spaced-comment // @@ -2200,7 +2200,6 @@ function opacify(amount, color) { var curriedOpacify = /*#__PURE__*/curry(opacify); // eslint-disable-line spaced-comment // - var h = function h(c) { return c / 255 <= 0.03928 ? c / 255 / 12.92 : Math.pow((c / 255 + 0.055) / 1.055, 2.4); }; diff --git a/docs/docs/index.html b/docs/docs/index.html index 21fd4fe0..df79df06 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -855,7 +855,7 @@

- + src/mixins/clearFix.js @@ -946,7 +946,7 @@

- + src/mixins/ellipsis.js @@ -1040,7 +1040,7 @@

- + src/mixins/fontFace.js @@ -1207,7 +1207,7 @@

- + src/mixins/hiDPI.js @@ -1304,7 +1304,7 @@

- + src/mixins/hideText.js @@ -1384,7 +1384,7 @@

- + src/mixins/normalize.js @@ -1472,7 +1472,7 @@

- + src/mixins/placeholder.js @@ -1580,7 +1580,7 @@

- + src/mixins/radialGradient.js @@ -1725,7 +1725,7 @@

- + src/mixins/retinaImage.js @@ -1855,7 +1855,7 @@

- + src/mixins/selection.js @@ -1959,7 +1959,7 @@

- + src/mixins/timingFunctions.js @@ -2047,7 +2047,7 @@

- + src/mixins/triangle.js @@ -2190,7 +2190,7 @@

- + src/mixins/wordWrap.js @@ -2293,7 +2293,7 @@

- + src/color/adjustHue.js @@ -2393,7 +2393,7 @@

- + src/color/complement.js @@ -2483,7 +2483,7 @@

- + src/color/darken.js @@ -2582,7 +2582,7 @@

- + src/color/desaturate.js @@ -2682,7 +2682,7 @@

- + src/color/grayscale.js @@ -2772,7 +2772,7 @@

- + src/color/hsl.js @@ -2879,7 +2879,7 @@

- + src/color/hsla.js @@ -2997,7 +2997,7 @@

- + src/color/invert.js @@ -3088,7 +3088,7 @@

- + src/color/lighten.js @@ -3187,7 +3187,7 @@

- + src/color/mix.js @@ -3302,7 +3302,7 @@

- + src/color/opacify.js @@ -3404,7 +3404,7 @@

- + src/color/parseToHsl.js @@ -3483,7 +3483,7 @@

- + src/color/parseToRgb.js @@ -3562,7 +3562,7 @@

- + src/color/readableColor.js @@ -3657,7 +3657,7 @@

- + src/color/rgb.js @@ -3764,7 +3764,7 @@

- + src/color/rgba.js @@ -3889,7 +3889,7 @@

- + src/color/saturate.js @@ -3990,7 +3990,7 @@

- + src/color/setHue.js @@ -4089,7 +4089,7 @@

- + src/color/setLightness.js @@ -4188,7 +4188,7 @@

- + src/color/setSaturation.js @@ -4287,7 +4287,7 @@

- + src/color/shade.js @@ -4385,7 +4385,7 @@

- + src/color/tint.js @@ -4483,7 +4483,7 @@

- + src/color/transparentize.js @@ -4597,7 +4597,7 @@

- + src/shorthands/animation.js @@ -4703,7 +4703,7 @@

- + src/shorthands/backgroundImages.js @@ -4791,7 +4791,7 @@

- + src/shorthands/backgrounds.js @@ -4879,7 +4879,7 @@

- + src/shorthands/borderColor.js @@ -4970,7 +4970,7 @@

- + src/shorthands/borderRadius.js @@ -5067,7 +5067,7 @@

- + src/shorthands/borderStyle.js @@ -5158,7 +5158,7 @@

- + src/shorthands/borderWidth.js @@ -5249,7 +5249,7 @@

- + src/shorthands/buttons.js @@ -5344,7 +5344,7 @@

- + src/shorthands/margin.js @@ -5435,7 +5435,7 @@

- + src/shorthands/padding.js @@ -5526,7 +5526,7 @@

- + src/shorthands/position.js @@ -5645,7 +5645,7 @@

- + src/shorthands/size.js @@ -5743,7 +5743,7 @@

- + src/shorthands/textInputs.js @@ -5850,7 +5850,7 @@

- + src/shorthands/transitions.js @@ -5950,7 +5950,7 @@

- + src/helpers/directionalProperty.js @@ -6049,7 +6049,7 @@

- + src/helpers/em.js @@ -6147,7 +6147,7 @@

- + src/helpers/modularScale.js @@ -6255,7 +6255,7 @@

- + src/helpers/rem.js @@ -6353,7 +6353,7 @@

- + src/helpers/stripUnit.js @@ -6453,7 +6453,7 @@

- + src/shorthands/animation.js @@ -6507,7 +6507,7 @@

- + src/mixins/fontFace.js @@ -6620,7 +6620,7 @@

- + src/types/color.js @@ -6697,7 +6697,7 @@

- + src/types/color.js @@ -6780,7 +6780,7 @@

- + src/types/interactionState.js @@ -6834,7 +6834,7 @@

- + src/mixins/triangle.js @@ -6888,7 +6888,7 @@

- + src/mixins/radialGradient.js @@ -6977,7 +6977,7 @@

- + src/helpers/modularScale.js @@ -7031,7 +7031,7 @@

- + src/types/color.js @@ -7114,7 +7114,7 @@

- + src/types/color.js @@ -7191,7 +7191,7 @@

- + src/mixins/timingFunctions.js @@ -7245,7 +7245,7 @@

- + src/color/toColorString.js @@ -7343,7 +7343,7 @@

- + src/types/modularScaleRatio.js diff --git a/package.json b/package.json index 1cd567d1..4a815885 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,7 @@ "prebuild:umd": "shx rm -rf dist/*", "prebuild:dist": "shx rm -rf dist/*", "build:dist": "rollup -c && rollup -c --environment PRODUCTION", - "build:docs": "npm run build:docs:site && npm run build:docs:readme", - "build:docs:readme": "documentation build src/** -t docs-theme/markdown.js --github -o docs -f html -c ./.documentation.json", + "build:docs": "npm run build:docs:site", "prebuild:docs:site": "shx rm -rf docs/*", "build:docs:site": "documentation build src/** -t docs-theme --github -o docs -f html -c ./.documentation.json", "postbuild:docs:site": "shx cp CNAME docs/CNAME && shx cp dist/polished.js docs/assets/",