@melcanz85/chaincss 1.5.4 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -42
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
# @melcanz85/chaincss
|
|
2
2
|
|
|
3
|
+
[](https://badge.fury.io/js/@melcanz85%2Fchaincss)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
3
6
|
A simple JavaScript-to-CSS transpiler that converts JS objects into optimized CSS.
|
|
4
7
|
|
|
5
8
|
## 🚀 Installation
|
|
6
9
|
|
|
7
10
|
```bash
|
|
8
11
|
npm install @melcanz85/chaincss
|
|
9
|
-
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
📦 Usage (Node.js)
|
|
14
|
+
Quick Setup
|
|
12
15
|
|
|
13
|
-
|
|
16
|
+
Install development dependencies:
|
|
17
|
+
|
|
18
|
+
bash
|
|
14
19
|
|
|
15
|
-
1. **Install development dependencies:**
|
|
16
|
-
```bash
|
|
17
20
|
npm install --save-dev nodemon concurrently
|
|
18
|
-
```
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
Update your package.json scripts:
|
|
23
|
+
|
|
24
|
+
json
|
|
25
|
+
|
|
22
26
|
"scripts": {
|
|
23
27
|
"start": "concurrently \"nodemon server.js\" \"nodemon --watch chaincss/*.jcss --watch processor.js --exec 'node processor.js'\""
|
|
24
28
|
}
|
|
25
|
-
```
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
Project Structure
|
|
28
31
|
|
|
29
32
|
Create this folder structure in your project:
|
|
33
|
+
text
|
|
30
34
|
|
|
31
|
-
```
|
|
32
35
|
your-project/
|
|
33
36
|
├── chaincss/ # ChainCSS source files
|
|
34
37
|
│ ├── chaincss.jcss # Main entry file
|
|
@@ -40,13 +43,12 @@ your-project/
|
|
|
40
43
|
├── node_modules/
|
|
41
44
|
├── package.json
|
|
42
45
|
└── package-lock.json
|
|
43
|
-
```
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
Processor Setup
|
|
46
48
|
|
|
47
|
-
In
|
|
49
|
+
In chaincss/processor.js:
|
|
50
|
+
javascript
|
|
48
51
|
|
|
49
|
-
```javascript
|
|
50
52
|
const jss = require("@melcanz85/chaincss");
|
|
51
53
|
|
|
52
54
|
try {
|
|
@@ -56,13 +58,11 @@ try {
|
|
|
56
58
|
console.error('Error processing JSS file:', err.stack);
|
|
57
59
|
process.exit(1);
|
|
58
60
|
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 💻 Code Examples
|
|
62
61
|
|
|
63
|
-
|
|
62
|
+
💻 Code Examples
|
|
63
|
+
Main File (chaincss/chaincss.jcss)
|
|
64
|
+
javascript
|
|
64
65
|
|
|
65
|
-
```javascript
|
|
66
66
|
<@
|
|
67
67
|
// Import chaining definitions
|
|
68
68
|
const style = get('./chain.jcss');
|
|
@@ -86,11 +86,10 @@ try {
|
|
|
86
86
|
);
|
|
87
87
|
@>
|
|
88
88
|
}
|
|
89
|
-
```
|
|
90
89
|
|
|
91
|
-
|
|
90
|
+
Chaining File (chaincss/chain.jcss)
|
|
91
|
+
javascript
|
|
92
92
|
|
|
93
|
-
```javascript
|
|
94
93
|
// Variables for consistent styling
|
|
95
94
|
const bodyBgColor = '#f0f0f0';
|
|
96
95
|
const headerBgColor = '#333';
|
|
@@ -132,32 +131,83 @@ module.exports = {
|
|
|
132
131
|
header,
|
|
133
132
|
logoImgHeight
|
|
134
133
|
};
|
|
135
|
-
```
|
|
136
134
|
|
|
137
|
-
|
|
135
|
+
📝 Notes
|
|
138
136
|
|
|
139
|
-
|
|
140
|
-
|--------|---------|-------------|
|
|
141
|
-
| ✅ | Basic JS → CSS | Convert plain JS objects to CSS |
|
|
142
|
-
| 🚧 | Keyframe animations | @keyframes support |
|
|
143
|
-
| 🚧 | Vendor prefixing | Auto-add -webkit-, -moz-, etc. |
|
|
144
|
-
| 🚧 | Source maps | Debug generated CSS |
|
|
145
|
-
| 🚧 | Watch mode | Auto-recompile on file changes |
|
|
137
|
+
CSS syntax can be written directly in .jcss files
|
|
146
138
|
|
|
147
|
-
|
|
139
|
+
ChainCSS syntax must be wrapped in <@ @> delimiters
|
|
148
140
|
|
|
149
|
-
|
|
141
|
+
The get() function imports chaining definitions from other files
|
|
150
142
|
|
|
151
|
-
|
|
152
|
-
- ChainCSS syntax must be wrapped in `<@ @>` delimiters
|
|
153
|
-
- The `get()` function imports chaining definitions from other files
|
|
154
|
-
- Style modifications between `get()` and `compile()` will override existing styles
|
|
143
|
+
Style modifications between get() and compile() will override existing styles
|
|
155
144
|
|
|
156
|
-
|
|
145
|
+
🎨 Editor Support
|
|
157
146
|
|
|
158
|
-
|
|
147
|
+
Since .jcss files are just JavaScript files with ChainCSS syntax, you can easily enable proper syntax highlighting in your editor:
|
|
148
|
+
VS Code
|
|
149
|
+
|
|
150
|
+
Add this to your project's .vscode/settings.json:
|
|
151
|
+
json
|
|
152
|
+
|
|
153
|
+
{
|
|
154
|
+
"files.associations": {
|
|
155
|
+
"*.jcss": "javascript"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
WebStorm / IntelliJ IDEA
|
|
160
|
+
|
|
161
|
+
Go to Settings/Preferences → Editor → File Types
|
|
162
|
+
|
|
163
|
+
Select JavaScript in the list
|
|
164
|
+
|
|
165
|
+
Click + and add *.jcss to the registered patterns
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
Vim / Neovim
|
|
161
168
|
|
|
162
|
-
|
|
169
|
+
Add to your .vimrc or init.vim:
|
|
170
|
+
vim
|
|
171
|
+
|
|
172
|
+
au BufRead,BufNewFile *.jcss setfiletype javascript
|
|
173
|
+
|
|
174
|
+
Sublime Text
|
|
175
|
+
|
|
176
|
+
Create or edit ~/Library/Application Support/Sublime Text/Packages/User/JCSS.sublime-settings:
|
|
177
|
+
json
|
|
178
|
+
|
|
179
|
+
{
|
|
180
|
+
"extensions": ["jcss"],
|
|
181
|
+
"syntax": "Packages/JavaScript/JavaScript.sublime-syntax"
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
Atom
|
|
185
|
+
|
|
186
|
+
Add to your config.cson:
|
|
187
|
+
coffeescript
|
|
188
|
+
|
|
189
|
+
"*":
|
|
190
|
+
core:
|
|
191
|
+
customFileTypes:
|
|
192
|
+
"source.js": [
|
|
193
|
+
"jcss"
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
Other Editors
|
|
197
|
+
|
|
198
|
+
Most modern editors allow you to associate file extensions with language modes. Simply configure your editor to treat .jcss files as JavaScript.
|
|
199
|
+
✨ Features
|
|
200
|
+
Status Feature Description
|
|
201
|
+
✅ Basic JS → CSS Convert plain JS objects to CSS
|
|
202
|
+
🚧 Keyframe animations @keyframes support
|
|
203
|
+
🚧 Vendor prefixing Auto-add -webkit-, -moz-, etc.
|
|
204
|
+
🚧 Source maps Debug generated CSS
|
|
205
|
+
🚧 Watch mode Auto-recompile on file changes
|
|
206
|
+
|
|
207
|
+
✅ = Working, 🚧 = Coming soon
|
|
208
|
+
👨💻 Contributing
|
|
209
|
+
|
|
210
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
211
|
+
📄 License
|
|
163
212
|
|
|
213
|
+
MIT © Rommel Caneos
|