π¨ Vanilla CSS Design System
A lightweight, modular, and highly customizable design system built with vanilla CSS. Perfect for creating consistent and responsive web applications.
π Features
- β Lightweight: No unnecessary dependencies, just pure CSS.
- π¦ Modular: Easily include only what you need.
- π¨ Customizable: Designed with CSS variables for easy theming.
- π Responsive: Built with mobile-first principles.
- β¨ Accessible: Follows accessibility standards and best practices.
π Documentation
Explore the full documentation and examples here: β‘οΈ Design System Documentation
π Quick Start
-
Clone the repository:
git clone https://github.com/pattespatte/vanilla-css-design-system.git -
Install dependencies (optional):
npm install -
Start the development server (recommended for development):
npm run devThis will:
- Automatically switch to development mode
- Start a local server at http://localhost:3000
- Watch for changes in CSS and token files
- Automatically rebuild and refresh your browser
-
Include the generated CSS in your project:
<link rel="stylesheet" href="styles/vanilla-combined.min.css">
Build CSS
Combine, purge, and minify CSS:
npm run build:css
Convert Between Formats
CSS β Tokens:
npm run css2tokens
npm run tokens2css
Development Workflow
This design system supports two modes: development and production.
Development Mode
In development mode, the examples use the unbuilt CSS files (main.css) which imports all individual CSS files. This allows for faster development and debugging.
Production Mode
In production mode, the examples use the optimized and minified CSS file (vanilla-combined.min.css) which contains only the CSS that is actually used.
Development Server with Hot Reload
Start a development server with automatic hot reload:
npm run dev
This command will:
- Switch to development mode automatically
- Start a server at http://localhost:3000
- Watch for changes in CSS and token files
- Rebuild CSS when changes are detected
- Automatically refresh your browser
Watch for Changes (Manual)
If you prefer to watch files without the development server:
npm run watch
This will watch for changes in the styles/ and tokens/ directories and rebuild the CSS when changes are detected.
Lint CSS
Check and fix CSS styles:
npm run lint:css
npm run lint:css:fix
Scripts Overview
| Script | Description |
|---|---|
dev |
Start development server with hot reload. |
dev:build |
Build CSS and start development server. |
build:css |
Combine, purge, and minify CSS. |
css2tokens |
Convert CSS to design tokens. |
tokens2css |
Convert design tokens to CSS. |
watch |
Watch for changes and rebuild/convert files. |
lint:css |
Lint CSS files. |
lint:css:fix |
Lint and fix CSS files. |
switch:dev |
Switch examples to use development CSS files. |
switch:prod |
Switch examples to use production CSS files. |
CDN Link
Simple usage – skip the installation steps and just include the ready-to-use combined CSS file with a CDN link to you own site:
Example:
<link rel="stylesheet" href="https://rawcdn.githack.com/pattespatte/vanilla-css-design-system/refs/tags/v1.0.2/styles/vanilla-combined.min.css">
π Folder Structure
vanilla-css-design-system/
βββ styles/ # CSS files (variables, components, utilities, etc.)
βββ scripts/ # Helper scripts for combining, purging, and converting CSS
βββ examples/ # Demo examples showcasing the design system
βββ tokens/ # Design tokens for easy customization
βββ README.md # Project documentation
βββ package.json # Project dependencies and scripts
π οΈ Tools & Technologies
- CSS: Vanilla CSS with a modular architecture.
- Stylelint: Linting for consistent coding standards.
- PurgeCSS: Removes unused CSS for optimized builds.
- Lightning CSS: Minifies the CSS for production.
- Nodemon: Watches for changes and automates tasks.
π Examples
Check out examples showcasing the design system in action: β‘οΈ View Examples
π License
This project is licensed under the MIT License. See the LICENSE file for details.
π¬ Contact & Contributions
- π€ Author: pattespatte
- π¬ Feedback: Found an issue or have a suggestion? Open an issue or submit a pull request.
- β‘οΈ Contribute
β€οΈ Support
If you find this project helpful, please consider giving it a β on GitHub!