Skip to content

Commit 7169a7c

Browse files
committed
Update README.md
1 parent 5845cbe commit 7169a7c

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed

.devcontainer/README.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Stylescape DevContainer
2+
3+
This repository provides a development container configuration for working on the `Stylescape` project. The configuration is optimized for Node.js, TypeScript, SCSS, and Jinja2 templating, providing a comprehensive development environment using Visual Studio Code's Dev Containers.
4+
5+
## DevContainer Configuration
6+
7+
The development container is configured with the following settings:
8+
9+
```json
10+
{
11+
"name": "Stylescape DevContainer",
12+
"build": {
13+
"dockerfile": "Dockerfile",
14+
"context": "."
15+
},
16+
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18",
17+
"features": {
18+
"ghcr.io/devcontainers/features/node:1": {
19+
"version": "18"
20+
}
21+
},
22+
"customizations": {
23+
"vscode": {
24+
"extensions": [
25+
"dbaeumer.vscode-eslint",
26+
"esbenp.prettier-vscode",
27+
"ms-python.python",
28+
"ms-vscode.vscode-typescript-next",
29+
"stylelint.vscode-stylelint",
30+
"streetsidesoftware.code-spell-checker",
31+
"redhat.vscode-yaml",
32+
"PKief.material-icon-theme",
33+
"syler.sass-indented",
34+
"vscode-icons-team.vscode-icons",
35+
"jinja.html-formatter",
36+
"ritwickdey.LiveServer",
37+
"gruntfuggly.todo-tree",
38+
"svelte.svelte-vscode",
39+
"octref.vetur"
40+
],
41+
"settings": {
42+
"editor.formatOnSave": true,
43+
"terminal.integrated.shell.linux": "/bin/bash",
44+
"files.associations": {
45+
"*.jinja": "jinja"
46+
}
47+
}
48+
}
49+
},
50+
"forwardPorts": [
51+
3000
52+
],
53+
"postCreateCommand": "npm install && pip3 install -r requirements.txt",
54+
"remoteUser": "vscode",
55+
"workspaceFolder": "/workspace",
56+
"mounts": [
57+
"source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached"
58+
],
59+
"remoteEnv": {
60+
"NODE_ENV": "development"
61+
},
62+
"containerEnv": {
63+
"NODE_ENV": "development"
64+
}
65+
}
66+
```
67+
68+
### Key Components
69+
70+
1. **Base Image**:
71+
- **Node.js Dev Container**: The development environment is based on the official Node.js Dev Container image `mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18`, which includes Node.js 18, ensuring consistency across development environments.
72+
73+
2. **VS Code Extensions**:
74+
The container is pre-configured with a comprehensive set of Visual Studio Code extensions to enhance your development experience:
75+
- **JavaScript/TypeScript**:
76+
- `dbaeumer.vscode-eslint`: Linting for JavaScript and TypeScript.
77+
- `esbenp.prettier-vscode`: Code formatting with Prettier.
78+
- `ms-vscode.vscode-typescript-next`: Enhanced TypeScript support.
79+
- **CSS/SCSS**:
80+
- `stylelint.vscode-stylelint`: Linting for CSS and SCSS files.
81+
- `syler.sass-indented`: Syntax highlighting for SCSS/SASS.
82+
- **Templating & Markup**:
83+
- `jinja.html-formatter`: Formatting for Jinja2 templates.
84+
- `redhat.vscode-yaml`: YAML support for configuration files.
85+
- `ritwickdey.LiveServer`: Live reloading for HTML files.
86+
- **Utility & Productivity**:
87+
- `streetsidesoftware.code-spell-checker`: Spell checking for text files.
88+
- `gruntfuggly.todo-tree`: Managing TODO comments effectively.
89+
- `PKief.material-icon-theme` and `vscode-icons-team.vscode-icons`: Custom icons for a better file explorer experience.
90+
- **Framework-Specific**:
91+
- `svelte.svelte-vscode`: Support for Svelte development.
92+
- `octref.vetur`: Support for Vue.js development.
93+
94+
3. **Post-Creation Commands**:
95+
- Automatically installs Node.js and Python dependencies using `npm install` and `pip3 install -r requirements.txt` after the container is created, ensuring your development environment is ready to go.
96+
97+
4. **Environment Variables**:
98+
- The `NODE_ENV` is set to `development` for both the remote and container environments, ensuring your application runs in development mode.
99+
100+
5. **VS Code Custom Settings**:
101+
- **Formatting**: Automatically formats your code on save, maintaining code consistency.
102+
- **File Associations**: Associates `.jinja` files with Jinja2 syntax highlighting.
103+
104+
### Usage Instructions
105+
106+
1. **Setup**:
107+
- Ensure Docker and Visual Studio Code are installed on your machine. Also, install the VS Code Dev Containers extension if not already installed.
108+
109+
2. **Add the DevContainer Configuration**:
110+
- Place the `devcontainer.json` file inside a `.devcontainer` directory at the root of your project.
111+
112+
3. **Open in Container**:
113+
- Open your project in Visual Studio Code. When prompted to "Reopen in Container", select this option to launch the development container.
114+
115+
4. **Working in the Container**:
116+
- Once the container is up, you can work in a fully-featured development environment with all necessary tools and dependencies configured.
117+
118+
### Benefits
119+
120+
- **Consistency**: Develop in a consistent environment that mirrors your production setup.
121+
- **Pre-configured Tools**: Start coding immediately with all essential tools and extensions pre-configured.
122+
- **Portability**: Easily share your development environment setup with team members.
123+
124+
### Customization
125+
126+
Feel free to customize the `devcontainer.json` file to better suit your needs. You can add or remove extensions, modify environment variables, or adjust settings as required.
127+
128+
### Troubleshooting
129+
130+
- If you encounter issues with the container setup, ensure Docker is running and that your system meets the requirements for using Dev Containers.
131+
- Check the logs in the VS Code terminal for any errors during the container build or startup process.
132+
133+
### Conclusion
134+
135+
This DevContainer setup for `Stylescape` provides a robust and efficient development environment, streamlining your workflow and ensuring consistency across different development setups. Enjoy coding in a fully integrated and customized environment!

0 commit comments

Comments
 (0)