{"id":16346596,"url":"https://github.com/matype/postcss-style-guide","last_synced_at":"2025-04-05T15:08:00.339Z","repository":{"id":30647929,"uuid":"34203523","full_name":"matype/postcss-style-guide","owner":"matype","description":"PostCSS plugin to generate a style guide automatically","archived":false,"fork":false,"pushed_at":"2017-07-05T10:15:05.000Z","size":461,"stargazers_count":526,"open_issues_count":8,"forks_count":33,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-16T03:31:29.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matype.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-19T11:11:09.000Z","updated_at":"2024-09-28T07:19:34.000Z","dependencies_parsed_at":"2022-09-08T11:03:38.654Z","dependency_job_id":null,"html_url":"https://github.com/matype/postcss-style-guide","commit_stats":null,"previous_names":["morishitter/postcss-style-guide","matype/postcss-style-guide"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matype%2Fpostcss-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matype%2Fpostcss-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matype%2Fpostcss-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matype%2Fpostcss-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matype","download_url":"https://codeload.github.com/matype/postcss-style-guide/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939210,"owners_count":20857920,"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-10-11T00:35:44.233Z","updated_at":"2025-04-05T15:08:00.303Z","avatar_url":"https://github.com/matype.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-style-guide [![Build Status](https://travis-ci.org/morishitter/postcss-style-guide.svg)](https://travis-ci.org/morishitter/postcss-style-guide)\n\n[PostCSS](https://github.com/postcss/postcss) plugin to generate a style guide automatically.\n\nCSS comments will be parsed through Markdown and displayed in a generated HTML document.\n\n## Install\n\n```shell\n$ npm install postcss-style-guide\n```\n\n## Example\n\nNode.js:\n\n```js\nvar fs = require('fs');\nvar postcss = require('postcss');\nvar styleguide = require('postcss-style-guide');\nvar input = fs.readFileSync('input.css', 'utf8');\n\nvar output = postcss([\n  styleguide\n]).process(input)\n.then(function (reuslt) {\n  var output = fs.readFileSync('styleGuide/index.html', 'utf8');\n  console.log('output:', output);\n});\n```\n\nin [Gulp](https://github.com/gulpjs/gulp):\n\n```js\nvar gulp = require('gulp')\n\ngulp.task('build:css', function () {\n    var concat = require('gulp-concat')\n    var postcss = require('gulp-postcss')\n    var autoprefixer = require('autoprefixer')\n    var customProperties = require('postcss-custom-properties')\n    var Import = require('postcss-import')\n    var styleGuide = require('postcss-style-guide')\n    var nano = require('cssnano')\n\n    return gulp.src('./app.css')\n        .pipe(postcss([\n            Import,\n            customProperties({ preserve: true }),\n            autoprefixer,\n            styleGuide({\n                project: 'Project name',\n                dest: 'styleguide/index.html',\n                showCode: false,\n                themePath: '../'\n            }),\n            nano\n        ]))\n        .pipe(concat('app.min.css'))\n        .pipe(gulp.dest('dist/css'))\n})\n```\n\nWe can generate color palette from CSS Custom Properties with `@start color` and `@end color` annotations.\n\n`app.css`:\n\n```css\n@import \"color\";\n@import \"button\";\n```\n\n`color.css`:\n\n```css\n@import \"button\";\n/* @start color */\n:root {\n    --red: #e23B00;\n    --blue: #3f526b;\n    --black: #000;\n    --background: #faf8f5;\n}\n/* @end color */\n```\n\npostcss-style-guide generate style guide from CSS comments that have special annotation(`@styleguide`).\n\n`@title`: set component name\n\n`button.css`:\n\n```css\n/*\n@styleguide\n\n@title Button\n\nUse the button classes on and `\u003ca\u003e`, `\u003cbutton\u003e`, `\u003cinput\u003e` elements.\n\n\u003cbutton class=\"button button--large button--red\"\u003eRed Button\u003c/button\u003e\n\n    \u003cbutton class=\"button button--large button--red\"\u003eRed Button\u003c/button\u003e\n\n\u003cbutton class=\"button button--large button--blue\"\u003eRed Button\u003c/button\u003e\n\n    \u003cbutton class=\"button button--large button--blue\"\u003eRed Button\u003c/button\u003e\n*/\n.button {\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 6px;\n    cursor: pointer;\n}\n\n.button--large {\n    width: 140px;\n    height: 40px;\n    font-size: 14px;\n}\n\n.button--red {\n    color: #fff;\n    background-color: var(--red);\n}\n\n.button--blue {\n    color: #fff;\n    background-color: var(--blue);\n}\n```\n\nYou will get `styleguide/index.html` for the style guide.\n\n![Default style guide design](./style-guide-default.png)\n\n\n## Options\n\n- `options.src`: The path to the source CSS file.\n- `options.dest`: The path to style guide file. (default: `styleguide/index.html`)\n- `options.project`: Project name. (default: `Style Guide`)\n- `options.showCode`: The flag to show CSS code (default: `true`)\n- `options.theme`: Theme name. (default: `psg-theme-default`)\n- `options.themePath`: The path to theme file. (default: `node_modules/psg-theme-default`)\n\n## Themes\n\nYou can select a theme of style guide with `options.theme`.\nAnd you can also create original themes.\nWhen you create themes, please read [theme guideline](https://github.com/morishitter/postcss-style-guide/blob/master/docs/theme-guideline.md)\n\nAll of postcss-style-guide themes that can be used are [here](https://www.npmjs.com/search?q=psg-theme).\n\n### Themes list\n\n- [default](https://github.com/morishitter/psg-theme-default)\n- [sassline](https://github.com/sotayamashita/psg-theme-sassline)\n- [1column](https://github.com/seka/psg-theme-1column)\n- [forest](https://github.com/morishitter/psg-theme-forest)\n\n### How to develop postcss-style-guide theme\n\n- [Yeoman Generator](https://github.com/sotayamashita/generator-psg-theme)\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2015 Masaaki Morishita\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatype%2Fpostcss-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatype%2Fpostcss-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatype%2Fpostcss-style-guide/lists"}