{"id":48465861,"url":"https://github.com/troychaplin/storybook-starter","last_synced_at":"2026-04-07T04:32:26.428Z","repository":{"id":335148278,"uuid":"1144331645","full_name":"troychaplin/storybook-starter","owner":"troychaplin","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-23T02:34:00.000Z","size":222,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-23T07:48:45.510Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/troychaplin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-28T15:22:01.000Z","updated_at":"2026-02-23T02:34:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"45a2a859-e8f7-4982-b243-89a9420b9010","html_url":"https://github.com/troychaplin/storybook-starter","commit_stats":null,"previous_names":["troychaplin/storybook-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/troychaplin/storybook-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fstorybook-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fstorybook-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fstorybook-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fstorybook-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/troychaplin","download_url":"https://codeload.github.com/troychaplin/storybook-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/troychaplin%2Fstorybook-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31500397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-04-07T04:32:22.698Z","updated_at":"2026-04-07T04:32:26.406Z","avatar_url":"https://github.com/troychaplin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Storybook Starter for Gutenberg\n\nA starter project for building component libraries that integrate seamlessly with WordPress Gutenberg blocks.\n\n## Features\n\n- **Storybook 10** for component development and documentation\n- **Vite** for fast builds\n- **TypeScript** for type safety\n- **CSS Variables** for easy theming\n- **Dual CSS output** - individual files for WordPress, bundled for React/Next.js\n\n## Quick Start\n\n```bash\n# Install dependencies\nnpm install\n\n# Start Storybook development server\nnpm run dev\n\n# Build the library\nnpm run build\n```\n\n## Project Structure\n\n```\n├── .storybook/          # Storybook configuration\n├── src/\n│   ├── components/      # Component library\n│   │   └── Card/\n│   │       ├── Card.tsx\n│   │       ├── Card.css\n│   │       ├── Card.stories.tsx\n│   │       └── index.ts\n│   ├── styles/\n│   │   ├── tokens.css   # CSS variables (design tokens)\n│   │   └── reset.css    # Base styles\n│   └── index.ts         # Library entry point\n├── dist/                # Build output\n│   ├── index.js         # ES module bundle\n│   ├── index.d.ts       # TypeScript declarations\n│   ├── styles.css       # Bundled CSS (all components)\n│   └── css/             # Individual CSS files\n│       ├── tokens.css\n│       ├── reset.css\n│       └── Card.css\n└── scripts/\n    └── build-css.js     # CSS build script\n```\n\n## Customizing the Prefix\n\nAll CSS variables use the `--prefix-` prefix (Component UI Library). To customize:\n\n1. Open `src/styles/tokens.css`\n2. Find and replace `--prefix-` with your prefix (e.g., `--mylib-`)\n3. Update component CSS files with the same replacement\n\n## Usage\n\n### WordPress Blocks (Recommended for WP)\n\nFor optimal WordPress performance, load CSS per-component:\n\n**Register styles in PHP:**\n\n```php\n// Register tokens globally (in theme or plugin init)\nwp_register_style(\n  'prefix-tokens',\n  'path/to/your-lib/dist/css/tokens.css',\n  [],\n  '1.0.0'\n);\n\n// Register component styles with token dependency\nwp_register_style(\n  'prefix-card',\n  'path/to/your-lib/dist/css/Card.css',\n  ['prefix-tokens'],\n  '1.0.0'\n);\n```\n\n**In block.json:**\n\n```json\n{\n  \"style\": \"file:./css/Card.css\",\n  \"editorStyle\": \"file:./css/Card.css\"\n}\n```\n\n**Static block (JS rendered):**\n\n```tsx\n// edit.tsx - CSS loaded via block.json, not JS import\nimport { Card } from 'your-component-library';\n\nexport default function Edit({ attributes }) {\n  return \u003cCard title={attributes.title}\u003e{attributes.content}\u003c/Card\u003e;\n}\n```\n\n**Dynamic block (PHP rendered):**\n\n```php\nfunction render_card_block($attributes) {\n  return sprintf(\n    '\u003carticle class=\"prefix-card\"\u003e\n      \u003cheader class=\"prefix-card__header\"\u003e\n        \u003ch3 class=\"prefix-card__title\"\u003e%s\u003c/h3\u003e\n      \u003c/header\u003e\n      \u003cdiv class=\"prefix-card__content\"\u003e%s\u003c/div\u003e\n    \u003c/article\u003e',\n    esc_html($attributes['title']),\n    wp_kses_post($attributes['content'])\n  );\n}\n```\n\n### React/Next.js\n\nFor non-WordPress projects, import the bundled CSS once:\n\n```tsx\n// _app.tsx or layout.tsx\nimport 'your-component-library/styles.css';\n\n// Use components anywhere\nimport { Card } from 'your-component-library';\n\nfunction MyPage() {\n  return (\n    \u003cCard title=\"Hello\"\u003e\n      \u003cp\u003eCard content here\u003c/p\u003e\n    \u003c/Card\u003e\n  );\n}\n```\n\n## WordPress theme.json Integration\n\nMap CSS variables to WordPress theme values:\n\n```css\n/* In your theme's CSS */\n:root {\n  --prefix-color-primary: var(--wp--preset--color--primary);\n  --prefix-spacing-md: var(--wp--preset--spacing--40);\n  --prefix-font-family-base: var(--wp--preset--font-family--body);\n}\n```\n\n## Scripts\n\n| Command | Description |\n|---------|-------------|\n| `npm run dev` | Start Storybook development server |\n| `npm run build` | Build library for distribution |\n| `npm run build:lib` | Build JS/TS only |\n| `npm run build:css` | Build CSS files only |\n| `npm run build-storybook` | Build static Storybook site |\n| `npm run typecheck` | Run TypeScript type checking |\n\n## Adding Components\n\n1. Create a folder: `src/components/ComponentName/`\n2. Add files:\n   - `ComponentName.tsx` - Component implementation\n   - `ComponentName.css` - Component styles\n   - `ComponentName.stories.tsx` - Storybook stories\n   - `index.ts` - Public export\n3. Export from `src/index.ts`\n\n## Publishing\n\n1. Update `name` in `package.json` to your package name\n2. Update `version` as needed\n3. Run `npm run build`\n4. Run `npm publish`\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroychaplin%2Fstorybook-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftroychaplin%2Fstorybook-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftroychaplin%2Fstorybook-starter/lists"}