zeus-css 1.0.4 → 1.0.6

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 CHANGED
@@ -10,32 +10,48 @@ npm install zeus-css
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### 1. Import Global Foundation
14
- Import the pre-compiled global foundation (Reset, Variable pipeline, utility classes) in your application entrypoint (e.g., `layout.tsx`, `_app.tsx` or `main.tsx`):
13
+ ### 1. Use the default theme (no build step)
14
+ If the shipped defaults are fine as-is, just import the pre-compiled stylesheet in your entrypoint (e.g., `layout.tsx`, `_app.tsx` or `main.tsx`):
15
15
 
16
16
  ```typescript
17
17
  import 'zeus-css/dist/zeus.css';
18
18
  ```
19
19
 
20
- ### 2. Generate Your Local Config
21
- Run the init command in your project root (you'll see a reminder for this after `npm install` too):
20
+ > `dist/zeus.css` is compiled at publish time and always contains the framework defaults. It cannot reflect local customization — for that, use your own theme build in step 2.
21
+
22
+ ### 2. Customize it
23
+ Run the init command in the folder you want the config files in (you'll see a reminder for this after `npm install` too):
22
24
 
23
25
  ```bash
24
26
  npx zeus-css init
25
27
  ```
26
28
 
27
- This creates `zeus.config.scss` and `zeus.customize.scss` directly in your project — not buried in `node_modules` — so you can edit them like any other file. Skip this step only if you're happy with the default theme as-is. Override colors, spacing, fonts, and more using OKLCH:
29
+ This drops four files into that folder — not buried in `node_modules`:
30
+
31
+ | File | Purpose |
32
+ | --- | --- |
33
+ | `zeus.config.scss` | **Edit this.** Feature toggles, breakpoints, layout engine settings. |
34
+ | `zeus.customize.scss` | **Edit this.** Design tokens — colors, typography, spacing, shadows. |
35
+ | `zeus.scss` | Generated bridge. Import it in `.module.scss` files for tokens/mixins. Emits no CSS. |
36
+ | `zeus.theme.scss` | Generated entry point. Compile it to get your themed global stylesheet. |
37
+
38
+ Edit your colors in `zeus.customize.scss` using OKLCH:
28
39
 
29
40
  ```scss
30
- // zeus.config.scss
31
41
  $zeus-colors: (
32
42
  "primary": oklch(57.9% 0.232 259.6),
33
43
  "secondary": oklch(74.7% 0.174 60.6)
34
44
  ) !default;
45
+ ```
46
+
47
+ Then compile `zeus.theme.scss` and link **that** output instead of `zeus-css/dist/zeus.css`:
35
48
 
36
- @forward "zeus-css/scss/zeus.scss";
49
+ ```bash
50
+ sass --load-path=node_modules zeus.theme.scss zeus.theme.css
37
51
  ```
38
52
 
53
+ Re-run this command after any edit to `zeus.config.scss` / `zeus.customize.scss`. Running `npx zeus-css init` again never overwrites files you already have.
54
+
39
55
  ### 3. Use CSS Variables in CSS Modules
40
56
  Thanks to the framework's token generation, you can natively use the fluid CSS variables everywhere:
41
57
 
@@ -54,6 +70,13 @@ Thanks to the framework's token generation, you can natively use the fluid CSS v
54
70
  }
55
71
  ```
56
72
 
73
+ ### Compiling with the `sass` CLI directly (no bundler)
74
+ Bundlers like Vite and Webpack resolve `@use "zeus-css/..."` automatically. The plain `sass` CLI does not — pass `--load-path=node_modules` or it will fail with `Can't find stylesheet to import`:
75
+
76
+ ```bash
77
+ sass --load-path=node_modules your-file.scss your-file.css
78
+ ```
79
+
57
80
  ## ⚠️ Optimizing for Production (Crucial)
58
81
  Zeus CSS ships with thousands of utility classes to give you absolute freedom during development. For production builds, you **must** use PurgeCSS to remove unused selectors and keep your CSS payload tiny.
59
82
 
package/bin/init.js CHANGED
@@ -6,36 +6,43 @@ const projectRoot = process.cwd();
6
6
  const configTargetPath = path.join(projectRoot, 'zeus.config.scss');
7
7
  const customizeTargetPath = path.join(projectRoot, 'zeus.customize.scss');
8
8
  const bridgeTargetPath = path.join(projectRoot, 'zeus.scss');
9
+ const themeTargetPath = path.join(projectRoot, 'zeus.theme.scss');
9
10
 
10
11
  const configSource = path.join(__dirname, '..', 'scss', 'zeus.config.scss');
11
12
  const customizeSource = path.join(__dirname, '..', 'scss', 'zeus.customize.scss');
12
13
 
13
14
  console.log('⚡ Initializing Zeus CSS Configuration (Eject Mode)...');
14
15
 
15
- if (fs.existsSync(configTargetPath) || fs.existsSync(bridgeTargetPath)) {
16
- console.log('⚠️ Zeus config files already exist in this directory. Skipping.');
17
- process.exit(0);
18
- }
16
+ // Checked per-file rather than all-or-nothing: a project initialized by an
17
+ // older version has no zeus.theme.scss, and an all-or-nothing guard would
18
+ // skip it forever on re-run. Generated entry points (zeus.scss/zeus.theme.scss)
19
+ // are safe to refresh; the two files the developer edits are never touched
20
+ // once they exist.
21
+ const writeIfMissing = (targetPath, produce, label) => {
22
+ if (fs.existsSync(targetPath)) {
23
+ console.log('⏭️ ' + label + ' already exists — leaving your copy untouched.');
24
+ return;
25
+ }
26
+ produce();
27
+ console.log('✅ Created ' + label);
28
+ };
19
29
 
20
30
  try {
21
31
  // 1. Copy original zeus.config.scss and zeus.customize.scss
22
- fs.copyFileSync(configSource, configTargetPath);
23
- fs.copyFileSync(customizeSource, customizeTargetPath);
24
- console.log('✅ Copied zeus.config.scss');
25
- console.log('✅ Copied zeus.customize.scss');
32
+ writeIfMissing(
33
+ configTargetPath,
34
+ () => fs.copyFileSync(configSource, configTargetPath),
35
+ 'zeus.config.scss'
36
+ );
37
+ writeIfMissing(
38
+ customizeTargetPath,
39
+ () => fs.copyFileSync(customizeSource, customizeTargetPath),
40
+ 'zeus.customize.scss'
41
+ );
26
42
 
27
- // 2. Generate the Bridge file
28
- const bridgeContent = `// ╔══════════════════════════════════════════════════════════════╗
29
- // ║ Zeus CSS — Bridge Entry Point ║
30
- // ║ Auto-generated by zeus-css init ║
31
- // ╚══════════════════════════════════════════════════════════════╝
32
- // This file injects your local configurations into the framework!
33
- // Do not edit this file unless you add/remove configuration keys.
34
-
35
- @use "./zeus.config.scss" as localConfig;
36
- @use "./zeus.customize.scss" as localCustomize;
37
-
38
- @use "zeus-css/scss/zeus.scss" with (
43
+ // Shared "with (...)" body — passes every local override into whichever
44
+ // framework entry point is being configured below.
45
+ const configArgs = `
39
46
  // 1. Config Variables
40
47
  $zeus-enable-responsive-classes: localConfig.$zeus-enable-responsive-classes,
41
48
  $zeus-enable-animation-classes: localConfig.$zeus-enable-animation-classes,
@@ -70,20 +77,71 @@ try {
70
77
  $zeus-z-index: localCustomize.$zeus-z-index,
71
78
  $zeus-custom-vars: localCustomize.$zeus-custom-vars,
72
79
  $zeus-button-variants: localCustomize.$zeus-button-variants
73
- );
80
+ `;
81
+
82
+ // 2. Generate the Bridge file — configured tokens/mixins/functions for
83
+ // .module.scss files. Emits zero CSS on its own (see zeus-css/scss/zeus.scss).
84
+ const bridgeContent = `// ╔══════════════════════════════════════════════════════════════╗
85
+ // ║ ⚡ Zeus CSS — Bridge Entry Point ║
86
+ // ║ Auto-generated by zeus-css init ║
87
+ // ╚══════════════════════════════════════════════════════════════╝
88
+ // This file injects your local configurations into the framework!
89
+ // Do not edit this file unless you add/remove configuration keys.
90
+ //
91
+ // No CSS is emitted here — use this in component .module.scss files for
92
+ // tokens/mixins/functions. For the actual compiled global stylesheet with
93
+ // your overrides baked in, compile zeus.theme.scss instead (see below).
94
+
95
+ @use "./zeus.config.scss" as localConfig;
96
+ @use "./zeus.customize.scss" as localCustomize;
97
+
98
+ @use "zeus-css/scss/zeus.scss" with (${configArgs});
74
99
 
75
100
  // Expose the configured framework so you can import it elsewhere
76
101
  @forward "zeus-css/scss/zeus.scss";
77
102
  `;
78
103
 
79
- fs.writeFileSync(bridgeTargetPath, bridgeContent, 'utf8');
80
- console.log('✅ Created zeus.scss (Bridge) successfully!');
81
-
104
+ writeIfMissing(
105
+ bridgeTargetPath,
106
+ () => fs.writeFileSync(bridgeTargetPath, bridgeContent, 'utf8'),
107
+ 'zeus.scss (bridge)'
108
+ );
109
+
110
+ // 3. Generate the Theme file — same configuration, but through the
111
+ // CSS-emitting foundation entry point. Compile this instead of linking
112
+ // zeus-css/dist/zeus.css if you want your overrides to actually show up.
113
+ const themeContent = `// ╔══════════════════════════════════════════════════════════════╗
114
+ // ║ ⚡ Zeus CSS — Theme Entry Point ║
115
+ // ║ Auto-generated by zeus-css init ║
116
+ // ╚══════════════════════════════════════════════════════════════╝
117
+ // Compile THIS file to get your global stylesheet with your local
118
+ // zeus.config.scss / zeus.customize.scss overrides baked in — the
119
+ // precompiled zeus-css/dist/zeus.css always ships with the framework
120
+ // defaults and never sees your local edits.
121
+ //
122
+ // sass --load-path=node_modules zeus.theme.scss zeus.theme.css
123
+ //
124
+ // Then link zeus.theme.css instead of zeus-css/dist/zeus.css.
125
+
126
+ @use "./zeus.config.scss" as localConfig;
127
+ @use "./zeus.customize.scss" as localCustomize;
128
+
129
+ @use "zeus-css/scss/foundation/foundation.scss" with (${configArgs});
130
+ `;
131
+
132
+ writeIfMissing(
133
+ themeTargetPath,
134
+ () => fs.writeFileSync(themeTargetPath, themeContent, 'utf8'),
135
+ 'zeus.theme.scss'
136
+ );
137
+
82
138
  console.log('\n🚀 Zeus CSS is fully ejected and ready!');
83
139
  console.log('Next steps:');
84
- console.log('1. Import your local bridge in your SCSS modules:');
140
+ console.log('1. For component .module.scss files, use the bridge (no CSS emitted):');
85
141
  console.log(' @use "./zeus.scss" as *;');
86
- console.log('2. Edit zeus.config.scss or zeus.customize.scss to update the framework globally.');
142
+ console.log('2. For your actual themed stylesheet, compile zeus.theme.scss and link its output instead of zeus-css/dist/zeus.css:');
143
+ console.log(' sass --load-path=node_modules zeus.theme.scss zeus.theme.css');
144
+ console.log('3. Edit zeus.config.scss or zeus.customize.scss and recompile to update the framework globally.');
87
145
  } catch (e) {
88
146
  console.error('❌ Failed to extract Zeus config files', e);
89
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zeus-css",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "⚡ A Premium, Zero-Emission, Fluid-Scaling CSS Framework based on Sass SCSS Engine",
5
5
  "author": "Stavros Lazaris",
6
6
  "license": "MIT",
@@ -14,6 +14,13 @@
14
14
  // ║ .module.scss), this file outputs real CSS classes. ║
15
15
  // ╚══════════════════════════════════════════════════════════════╝
16
16
 
17
+ // Forwarded (not just used) so that an external consumer can configure the
18
+ // framework directly through this entry point:
19
+ // @use "zeus-css/foundation" with ($zeus-colors: (...), ...);
20
+ // Without this forward, foundation.scss loads zeus.config with its defaults
21
+ // immediately, before any external `with (...)` could ever apply — silently
22
+ // locking every token to the shipped defaults regardless of local overrides.
23
+ @forward "../zeus.config";
17
24
  @use "../zeus.config" as config;
18
25
  @use "./core/design";
19
26
  @use "./core/engine";