An interactive platform for learning CSS and Tailwind CSS through practical challenges.
Code Crispies is a web-based learning platform designed to help users master CSS and Tailwind CSS through hands-on exercises. The application presents a series of progressive challenges organized into themed modules, allowing learners to build their skills step by step while receiving immediate feedback.
- Interactive Lessons: Learn CSS and Tailwind concepts through practical, hands-on challenges
- Dual Mode Support: Switch between CSS and Tailwind CSS learning modes
- Progressive Difficulty: Modules are structured to build skills gradually from basic to advanced
- Real-Time Feedback: Get immediate validation on your code solutions with comprehensive feedback
- Progress Tracking: Your learning progress is automatically saved in the browser
- Visual Preview: See the results of your code in real-time with live preview
- Comprehensive Modules: Cover various CSS and Tailwind topics in organized learning paths
- Schema-Validated Lessons: All lessons follow a strict JSON schema for consistency
- Pure JavaScript (ES Modules)
- HTML5 & CSS3
- Vite for bundling and development
- Vitest for testing with coverage reporting
- JSON Schema validation for lesson structure
- Local Storage for progress persistence
- whatwg-fetch polyfill for compatibility
- Node.js (v18 or higher recommended)
- npm (v8 or higher recommended)
-
NVM (optional)
nvm use
-
Clone the repository:
git clone https://github.com/nextlevelshit/code-crispies.git cd code-crispies
-
Install dependencies:
npm i
-
Start the development server:
npm start
-
Open your browser and navigate to:
http://localhost:1312
npm start
- Start the development server (alias fornpm run dev
)npm run dev
- Start the development server with host bindingnpm run build
- Build for productionnpm run preview
- Preview the production build locally with debug modenpm run test
- Run tests oncenpm run test.watch
- Run tests in watch modenpm run test.coverage
- Run tests with coverage reportnpm run format
- Format source code with Prettier (includes config files)npm run format.lessons
- Format lesson JSON files with Prettier
- Select a Module: Choose a learning module from the available options
- Choose Mode: Select between CSS or Tailwind CSS learning mode (if applicable)
- Read the Challenge: Each lesson includes a description, task instructions, and learning objectives
- Write Code: Enter your CSS or Tailwind solution in the editor
- Run Your Code: Click the "Run" button (or press Ctrl+Enter) to test your solution
- Review Feedback: Get comprehensive feedback with validation messages
- Progress: Move to the next lesson once your solution passes all validations
Ctrl+Enter
- Run your codeTab
- Insert appropriate indentation
code-crispies/
βββ coverage/ # Test coverage reports
βββ docs/ # Documentation files (multilingual)
βββ lessons/ # JSON lesson definitions
βββ public/ # Static assets and PWA manifests
βββ schemas/ # JSON Schema definitions
β βββ code-crispies-module-schema.json
βββ src/
β βββ config/ # Configuration files
β β βββ lessons.js # Module and lesson loading logic
β βββ helpers/ # Helper utilities
β β βββ renderer.js # UI rendering functions
β β βββ validator.js # Code validation logic
β βββ impl/
β β βββ LessonEngine.js # Core lesson processing logic
β βββ app.js # Main application entry point
β βββ index.html # Main HTML template
β βββ main.css # Global styles
βββ tests/ # Test files
β βββ setup.js # Test configuration
β βββ unit/ # Unit tests
βββ vite.config.js # Vite configuration
βββ vitest.config.js # Vitest configuration
Lessons are defined in JSON format following the schema in schemas/code-crispies-module-schema.json
. Each module includes comprehensive lesson definitions with validation rules.
{
"id": "unique-module-id",
"title": "Module Title",
"description": "Detailed description of module content and purpose",
"mode": "css", // or "tailwind"
"difficulty": "beginner", // "intermediate" or "advanced"
"lessons": [
// Lesson objects...
]
}
{
"id": "unique-lesson-id",
"title": "Lesson Title",
"description": "Detailed lesson description and concepts",
"mode": "css", // Optional override for module mode
"task": "Specific task instructions for the student",
"previewHTML": "<div>HTML for preview</div>",
"previewBaseCSS": "/* Base styles for preview */",
"sandboxCSS": "/* Additional sandbox styles */",
"initialCode": "/* Starting code for student */",
"solution": "/* Optional solution code */",
"previewContainer": "container-id",
"validations": [
{
"type": "contains", // "contains_class", "not_contains", "regex", "property_value", "syntax", "custom"
"value": "expected-content",
"message": "Feedback message for validation failure",
"options": {
"caseSensitive": false
}
}
]
}
- contains: Check if code contains specific text
- contains_class: Check if HTML contains specific CSS class
- not_contains: Ensure code doesn't contain specific text
- regex: Validate against regular expression pattern
- property_value: Validate specific CSS property values
- syntax: Check for valid CSS syntax
- custom: Custom validation logic
The project uses Vitest for comprehensive testing with coverage reporting. Tests are organized in the tests/unit/
directory.
Run tests:
npm run test
Run tests in watch mode:
npm run test.watch
Generate coverage report:
npm run test.coverage
Coverage reports are generated in the coverage/
directory with detailed HTML reports.
To build the project for production:
npm run build
The output will be generated in the dist/
directory, which can be deployed to any static web server.
For GitHub Pages deployment, the configuration is already set up with the base path /code-crispies/
.
Preview the production build locally:
npm run preview
The project supports multilingual documentation in the docs/
directory:
- English documentation (
en-*.md
) - German documentation (
de-*.md
)
Contributions are welcome! Please ensure all lessons follow the JSON schema validation.
- Fork the repository
- Create your feature branch (
git switch -c feature/amazing-feature
) - Add/modify lessons following the schema in
schemas/code-crispies-module-schema.json
- Format your code:
npm run format
andnpm run format.lessons
- Run tests:
npm run test
- Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
When adding new lessons:
- Create or modify JSON files in the
lessons/
directory - Ensure they validate against the schema
- Test thoroughly with various validation scenarios
- Update documentation if needed
Copyright (c) 2025 Michael Czechowski. Licensed under the ./LICENSE.