@melcanz85/chaincss 1.5.6 → 1.5.8
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 +52 -41
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,12 +33,12 @@ Create this folder structure in your project:
|
|
|
33
33
|
|
|
34
34
|
your-project/
|
|
35
35
|
├── chaincss/ # ChainCSS source files
|
|
36
|
-
│ ├──
|
|
36
|
+
│ ├── main.jcss # Main entry file
|
|
37
37
|
│ ├── chain.jcss # Chaining definitions
|
|
38
38
|
│ └── processor.js # Processing script
|
|
39
39
|
├── public/ # Output files
|
|
40
40
|
│ ├── index.html
|
|
41
|
-
│ └──
|
|
41
|
+
│ └── style.css # Generated CSS
|
|
42
42
|
├── node_modules/
|
|
43
43
|
├── package.json
|
|
44
44
|
└── package-lock.json
|
|
@@ -47,44 +47,21 @@ Processor Setup
|
|
|
47
47
|
|
|
48
48
|
In chaincss/processor.js:
|
|
49
49
|
|
|
50
|
-
const
|
|
50
|
+
const chain = require("@melcanz85/chaincss");
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
// Process main file and output CSS
|
|
54
|
-
|
|
54
|
+
chain.processor('./chaincss/main.jcss', './public/style.css');
|
|
55
55
|
} catch (err) {
|
|
56
56
|
console.error('Error processing chainCSS file:', err.stack);
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
💻 Code Examples
|
|
61
|
-
Main File (chaincss/chaincss.jcss):
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
// Import chaining definitions
|
|
65
|
-
const style = get('./chain.jcss');
|
|
62
|
+
--Chaining File (chaincss/chain.jcss):
|
|
66
63
|
|
|
67
|
-
|
|
68
|
-
style.navA.color = 'red';
|
|
69
|
-
|
|
70
|
-
// Compile to CSS
|
|
71
|
-
compile(style);
|
|
72
|
-
@>
|
|
73
|
-
|
|
74
|
-
@media (max-width: 768px) {
|
|
75
|
-
<@
|
|
76
|
-
run(
|
|
77
|
-
chaincss.flexDirection('column').alignItems('flex-start').block('header'),
|
|
78
|
-
chaincss.order(1).block('.logo'),
|
|
79
|
-
chaincss.order(2).block('.search-bar'),
|
|
80
|
-
chaincss.order(3).block('h1'),
|
|
81
|
-
chaincss.order(5).block('nav'),
|
|
82
|
-
chaincss.order(4).display('flex').width('100%').justifyContent('flex-end').block('.burgerWrapper')
|
|
83
|
-
);
|
|
84
|
-
@>
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Chaining File (chaincss/chain.jcss):
|
|
64
|
+
*** This is where the chaining happens all codes here are javascript codes the methods are the css properties but since its a js code its a camelCase syntax example the property font-family its fontFamily in chaincss syntax.
|
|
88
65
|
|
|
89
66
|
// Variables for consistent styling
|
|
90
67
|
const bodyBgColor = '#f0f0f0';
|
|
@@ -94,20 +71,20 @@ const headerAlignItems = 'center';
|
|
|
94
71
|
const logoHeight = '50px';
|
|
95
72
|
|
|
96
73
|
// Reset browser defaults
|
|
97
|
-
const resetDefaultBrowStyle =
|
|
74
|
+
const resetDefaultBrowStyle = chain
|
|
98
75
|
.margin('0')
|
|
99
76
|
.padding('0')
|
|
100
77
|
.block('body', 'h1', 'h2', 'h3', 'p', 'ul');
|
|
101
78
|
|
|
102
79
|
// Body styles
|
|
103
|
-
const bodyStyle =
|
|
80
|
+
const bodyStyle = chain
|
|
104
81
|
.fontFamily(bodyFontFamily)
|
|
105
82
|
.lineHeight('1.6')
|
|
106
83
|
.bgColor(bodyBgColor)
|
|
107
84
|
.block('body');
|
|
108
85
|
|
|
109
86
|
// Header styles
|
|
110
|
-
const header =
|
|
87
|
+
const header = chain
|
|
111
88
|
.display('flex')
|
|
112
89
|
.alignItems(headerAlignItems)
|
|
113
90
|
.justifyContent('space-between')
|
|
@@ -117,7 +94,7 @@ const header = chaincss
|
|
|
117
94
|
.block('header');
|
|
118
95
|
|
|
119
96
|
// Logo
|
|
120
|
-
const logoImgHeight =
|
|
97
|
+
const logoImgHeight = chain
|
|
121
98
|
.height(logoHeight)
|
|
122
99
|
.block('.logo img');
|
|
123
100
|
|
|
@@ -128,6 +105,34 @@ module.exports = {
|
|
|
128
105
|
logoImgHeight
|
|
129
106
|
};
|
|
130
107
|
|
|
108
|
+
|
|
109
|
+
--Main File (chaincss/main.jcss):
|
|
110
|
+
|
|
111
|
+
<@
|
|
112
|
+
// Import chaining definitions
|
|
113
|
+
const style = get('./chain.jcss');
|
|
114
|
+
|
|
115
|
+
// Override specific styles
|
|
116
|
+
style.header.bgColor = 'red';
|
|
117
|
+
|
|
118
|
+
// Compile to CSS
|
|
119
|
+
compile(style);
|
|
120
|
+
@>
|
|
121
|
+
|
|
122
|
+
@media (max-width: 768px) {
|
|
123
|
+
<@
|
|
124
|
+
run(
|
|
125
|
+
chain.flexDirection('column').alignItems('flex-start').block('header'),
|
|
126
|
+
chain.order(1).block('.logo'),
|
|
127
|
+
chain.order(2).block('.search-bar'),
|
|
128
|
+
chain.order(3).block('h1'),
|
|
129
|
+
chain.order(5).block('nav'),
|
|
130
|
+
chain.order(4).display('flex').width('100%').justifyContent('flex-end').block('.burgerWrapper')
|
|
131
|
+
);
|
|
132
|
+
@>
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
131
136
|
📝 Notes
|
|
132
137
|
|
|
133
138
|
You can directly put css syntax on your main file.
|
|
@@ -194,18 +199,24 @@ Most modern editors allow you to associate file extensions with language modes.
|
|
|
194
199
|
|
|
195
200
|
|
|
196
201
|
✨ Features
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
🚧
|
|
202
|
+
|
|
203
|
+
Status Feature Description
|
|
204
|
+
|
|
205
|
+
✅ Basic JS → CSS Convert plain JS objects to CSS
|
|
206
|
+
|
|
207
|
+
🚧 Keyframe animations @keyframes support
|
|
208
|
+
|
|
209
|
+
🚧 Vendor prefixing Auto-add -webkit-, -moz-, etc.
|
|
210
|
+
|
|
211
|
+
🚧 Source maps Debug generated CSS
|
|
212
|
+
|
|
213
|
+
🚧 Watch mode Auto-recompile on file changes
|
|
203
214
|
|
|
204
215
|
✅ = Working, 🚧 = Coming soon
|
|
205
|
-
👨💻 Contributing
|
|
206
216
|
|
|
207
|
-
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
208
217
|
|
|
218
|
+
👨💻 Contributing
|
|
219
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
209
220
|
|
|
210
221
|
📄 License
|
|
211
222
|
|