Skip to content

Commit 3338c01

Browse files
committed
docs: update README to include Tailwind CSS support and enhance clarity
1 parent 4664bc7 commit 3338c01

File tree

1 file changed

+122
-62
lines changed

1 file changed

+122
-62
lines changed

README.md

Lines changed: 122 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
![Code Crispies Logo](./public/android-chrome-192x192.png)
22
# Code Crispies
33

4-
An interactive platform for learning CSS through practical challenges.
4+
An interactive platform for learning CSS and Tailwind CSS through practical challenges.
55

66
## 📚 Overview
77

8-
Code Crispies is a web-based learning platform designed to help users master 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.
8+
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.
99

1010
### Key Features
1111

12-
- **Interactive Lessons**: Learn CSS concepts through practical, hands-on challenges
12+
- **Interactive Lessons**: Learn CSS and Tailwind concepts through practical, hands-on challenges
13+
- **Dual Mode Support**: Switch between CSS and Tailwind CSS learning modes
1314
- **Progressive Difficulty**: Modules are structured to build skills gradually from basic to advanced
14-
- **Real-Time Feedback**: Get immediate validation on your code solutions
15+
- **Real-Time Feedback**: Get immediate validation on your code solutions with comprehensive feedback
1516
- **Progress Tracking**: Your learning progress is automatically saved in the browser
16-
- **Visual Preview**: See the results of your CSS code in real-time
17-
- **Comprehensive Modules**: Cover various CSS topics in organized learning paths
17+
- **Visual Preview**: See the results of your code in real-time with live preview
18+
- **Comprehensive Modules**: Cover various CSS and Tailwind topics in organized learning paths
19+
- **Schema-Validated Lessons**: All lessons follow a strict JSON schema for consistency
1820

1921
## 🛠️ Technical Stack
2022

2123
- Pure JavaScript (ES Modules)
2224
- HTML5 & CSS3
2325
- Vite for bundling and development
24-
- Vitest for testing
26+
- Vitest for testing with coverage reporting
27+
- JSON Schema validation for lesson structure
2528
- Local Storage for progress persistence
29+
- whatwg-fetch polyfill for compatibility
2630

2731
## 🚀 Getting Started
2832

@@ -33,7 +37,7 @@ Code Crispies is a web-based learning platform designed to help users master CSS
3337

3438
### Installation
3539

36-
0. NVM (optional)
40+
0. NVM (optional)
3741
```bash
3842
nvm use
3943
```
@@ -61,105 +65,139 @@ Code Crispies is a web-based learning platform designed to help users master CSS
6165

6266
### Available Scripts
6367

64-
- `npm run dev` - Start the development server
68+
- `npm start` - Start the development server (alias for `npm run dev`)
69+
- `npm run dev` - Start the development server with host binding
6570
- `npm run build` - Build for production
66-
- `npm run preview` - Preview the production build locally
67-
- `npm run test` - Run tests
71+
- `npm run preview` - Preview the production build locally with debug mode
72+
- `npm run test` - Run tests once
6873
- `npm run test.watch` - Run tests in watch mode
6974
- `npm run test.coverage` - Run tests with coverage report
70-
- `npm run format` - Format source code with Prettier
75+
- `npm run format` - Format source code with Prettier (includes config files)
7176
- `npm run format.lessons` - Format lesson JSON files with Prettier
7277

7378
## 📖 Usage Guide
7479

7580
### How to Use Code Crispies
7681

77-
1. **Select a Module**: Choose a learning module from the Progress menu
78-
2. **Read the Challenge**: Each lesson includes an objective and task instructions
79-
3. **Write CSS Code**: Enter your CSS solution in the editor
80-
4. **Run Your Code**: Click the "Run" button (or press Ctrl+Enter) to test your solution
81-
5. **Review Feedback**: Get immediate feedback on your solution
82-
6. **Progress**: Move to the next lesson once your solution is correct
82+
1. **Select a Module**: Choose a learning module from the available options
83+
2. **Choose Mode**: Select between CSS or Tailwind CSS learning mode (if applicable)
84+
3. **Read the Challenge**: Each lesson includes a description, task instructions, and learning objectives
85+
4. **Write Code**: Enter your CSS or Tailwind solution in the editor
86+
5. **Run Your Code**: Click the "Run" button (or press Ctrl+Enter) to test your solution
87+
6. **Review Feedback**: Get comprehensive feedback with validation messages
88+
7. **Progress**: Move to the next lesson once your solution passes all validations
8389

8490
### Keyboard Shortcuts
8591

8692
- `Ctrl+Enter` - Run your code
87-
- `Tab` - Insert two spaces (for indentation)
93+
- `Tab` - Insert appropriate indentation
8894

8995
## 🧩 Project Structure
9096

9197
```
9298
code-crispies/
93-
├── public/ # Static assets
99+
├── coverage/ # Test coverage reports
100+
├── docs/ # Documentation files (multilingual)
101+
├── lessons/ # JSON lesson definitions
102+
├── public/ # Static assets and PWA manifests
103+
├── schemas/ # JSON Schema definitions
104+
│ └── code-crispies-module-schema.json
94105
├── src/
95-
│ ├── config/ # Configuration files
96-
│ │ └── lessons.js # Module and lesson definitions
97-
│ ├── helpers/ # Helper utilities
106+
│ ├── config/ # Configuration files
107+
│ │ └── lessons.js # Module and lesson loading logic
108+
│ ├── helpers/ # Helper utilities
98109
│ │ ├── renderer.js # UI rendering functions
99110
│ │ └── validator.js # Code validation logic
100111
│ ├── impl/
101112
│ │ └── LessonEngine.js # Core lesson processing logic
102-
│ ├── app.js # Main application entry point
103-
│ ├── index.html # Main HTML template
104-
│ └── main.css # Global styles
105-
├── tests/ # Test files
106-
│ ├── setup.js # Test configuration
107-
│ └── *.test.js # Test files
108-
├── vite.config.js # Vite configuration
109-
└── vitest.config.js # Vitest configuration
113+
│ ├── app.js # Main application entry point
114+
│ ├── index.html # Main HTML template
115+
│ └── main.css # Global styles
116+
├── tests/ # Test files
117+
│ ├── setup.js # Test configuration
118+
│ └── unit/ # Unit tests
119+
├── vite.config.js # Vite configuration
120+
└── vitest.config.js # Vitest configuration
110121
```
111122

112123
## 📝 Adding New Lessons
113124

114-
Lessons are defined in JSON format in the `lessons.js` file. Each lesson includes:
125+
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.
115126

116-
- Title and description
117-
- Task instructions
118-
- HTML content for the preview area
119-
- CSS prefix and suffix (the code before and after the user's input)
120-
- Validation criteria
127+
### Module Structure
121128

122-
Example lesson structure:
129+
```json
130+
{
131+
"id": "unique-module-id",
132+
"title": "Module Title",
133+
"description": "Detailed description of module content and purpose",
134+
"mode": "css", // or "tailwind"
135+
"difficulty": "beginner", // "intermediate" or "advanced"
136+
"lessons": [
137+
// Lesson objects...
138+
]
139+
}
140+
```
141+
142+
### Lesson Structure
123143

124-
```js
144+
```json
125145
{
126-
id: "selector-basics",
127-
title: "CSS Selectors Basics",
128-
description: "Learn to select and style HTML elements",
129-
lessons: [
146+
"id": "unique-lesson-id",
147+
"title": "Lesson Title",
148+
"description": "Detailed lesson description and concepts",
149+
"mode": "css", // Optional override for module mode
150+
"task": "Specific task instructions for the student",
151+
"previewHTML": "<div>HTML for preview</div>",
152+
"previewBaseCSS": "/* Base styles for preview */",
153+
"sandboxCSS": "/* Additional sandbox styles */",
154+
"initialCode": "/* Starting code for student */",
155+
"solution": "/* Optional solution code */",
156+
"previewContainer": "container-id",
157+
"validations": [
130158
{
131-
title: "Element Selectors",
132-
description: "Style HTML elements using element selectors",
133-
taskDescription: "Make all paragraphs red",
134-
html: "<p>This is a paragraph</p><p>This is another paragraph</p>",
135-
cssPrefix: "/* Write your CSS below */\n",
136-
cssSuffix: "",
137-
validationCriteria: {
138-
type: "regex",
139-
pattern: "p\\s*{\\s*color\\s*:\\s*red\\s*;?\\s*}"
159+
"type": "contains", // "contains_class", "not_contains", "regex", "property_value", "syntax", "custom"
160+
"value": "expected-content",
161+
"message": "Feedback message for validation failure",
162+
"options": {
163+
"caseSensitive": false
140164
}
141165
}
142-
// More lessons...
143166
]
144167
}
145168
```
146169

147-
## 🧪 Testing
170+
### Validation Types
171+
172+
- **contains**: Check if code contains specific text
173+
- **contains_class**: Check if HTML contains specific CSS class
174+
- **not_contains**: Ensure code doesn't contain specific text
175+
- **regex**: Validate against regular expression pattern
176+
- **property_value**: Validate specific CSS property values
177+
- **syntax**: Check for valid CSS syntax
178+
- **custom**: Custom validation logic
148179

149-
The project uses Vitest for testing. Tests are located in the `tests/` directory.
180+
## 🧪 Testing
150181

151-
Run tests with:
182+
The project uses Vitest for comprehensive testing with coverage reporting. Tests are organized in the `tests/unit/` directory.
152183

184+
Run tests:
153185
```bash
154186
npm run test
155187
```
156188

157-
Generate coverage report:
189+
Run tests in watch mode:
190+
```bash
191+
npm run test.watch
192+
```
158193

194+
Generate coverage report:
159195
```bash
160196
npm run test.coverage
161197
```
162198

199+
Coverage reports are generated in the `coverage/` directory with detailed HTML reports.
200+
163201
## 🚢 Deployment
164202

165203
To build the project for production:
@@ -172,16 +210,38 @@ The output will be generated in the `dist/` directory, which can be deployed to
172210

173211
For GitHub Pages deployment, the configuration is already set up with the base path `/code-crispies/`.
174212

213+
Preview the production build locally:
214+
```bash
215+
npm run preview
216+
```
217+
218+
## 🌐 Internationalization
219+
220+
The project supports multilingual documentation in the `docs/` directory:
221+
- English documentation (`en-*.md`)
222+
- German documentation (`de-*.md`)
223+
175224
## 🤝 Contributing
176225

177-
Contributions are welcome! Please feel free to submit a Pull Request.
226+
Contributions are welcome! Please ensure all lessons follow the JSON schema validation.
178227

179228
1. Fork the repository
180229
2. Create your feature branch (`git switch -c feature/amazing-feature`)
181-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
182-
4. Push to the branch (`git push origin feature/amazing-feature`)
183-
5. Open a Pull Request
230+
3. Add/modify lessons following the schema in `schemas/code-crispies-module-schema.json`
231+
4. Format your code: `npm run format` and `npm run format.lessons`
232+
5. Run tests: `npm run test`
233+
6. Commit your changes (`git commit -m 'Add some amazing feature'`)
234+
7. Push to the branch (`git push origin feature/amazing-feature`)
235+
8. Open a Pull Request
236+
237+
### Adding New Lessons
238+
239+
When adding new lessons:
240+
1. Create or modify JSON files in the `lessons/` directory
241+
2. Ensure they validate against the schema
242+
3. Test thoroughly with various validation scenarios
243+
4. Update documentation if needed
184244

185245
## 📄 License
186246

187-
Copyright (c) 2023 Michael Czechowski. Licensed under the [./LICENSE](WTFPL).
247+
Copyright (c) 2025 Michael Czechowski. Licensed under the [./LICENSE](WTFPL).

0 commit comments

Comments
 (0)