swatchkit 0.2.2 → 0.2.4

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/build.js CHANGED
@@ -153,7 +153,7 @@ function resolveSettings(cliOptions, fileConfig) {
153
153
  distPreviewDir: path.join(outDir, "preview"),
154
154
  outputFile: path.join(outDir, "index.html"),
155
155
  outputJsFile: path.join(outDir, "js/swatches.js"),
156
- tokensCssFile: path.join(cssDir, "tokens.css"),
156
+ tokensCssFile: path.join(cssDir, "global", "tokens.css"),
157
157
  mainCssFile: path.join(cssDir, "main.css"),
158
158
  };
159
159
  }
@@ -188,6 +188,13 @@ function runInit(settings, options) {
188
188
  fs.mkdirSync(settings.cssDir, { recursive: true });
189
189
  }
190
190
 
191
+ // Create css/global directory
192
+ const globalCssDir = path.join(settings.cssDir, "global");
193
+ if (!fs.existsSync(globalCssDir)) {
194
+ console.log(`+ Directory: ${globalCssDir}`);
195
+ fs.mkdirSync(globalCssDir, { recursive: true });
196
+ }
197
+
191
198
  // Copy JSON token blueprints to tokens/ (project root)
192
199
  const copyDefault = (srcFilename, destFilename) => {
193
200
  const destPath = path.join(tokensDir, destFilename);
@@ -252,19 +259,17 @@ function runInit(settings, options) {
252
259
  }
253
260
  };
254
261
 
255
- copyCssBlueprint("variables.css");
256
- copyCssBlueprint("global-styles.css");
262
+ // Global blueprints are now copied as a folder below
257
263
 
258
264
  fs.writeFileSync(settings.mainCssFile, content);
259
265
  console.log(`+ CSS Blueprint: main.css`);
260
266
  }
261
267
 
262
- // Copy CSS Reset
263
- const resetSrc = path.join(__dirname, "src/blueprints/reset.css");
264
- const resetDest = path.join(settings.cssDir, "reset.css");
265
- if (fs.existsSync(resetSrc) && !fs.existsSync(resetDest)) {
266
- fs.copyFileSync(resetSrc, resetDest);
267
- console.log(`+ CSS Blueprint: reset.css`);
268
+ // Copy Global Styles Folder
269
+ const globalSrc = path.join(__dirname, "src/blueprints/global");
270
+ const globalDest = path.join(settings.cssDir, "global");
271
+ if (fs.existsSync(globalSrc)) {
272
+ copyDir(globalSrc, globalDest);
268
273
  }
269
274
 
270
275
  // Copy Compositions
@@ -283,7 +288,10 @@ function runInit(settings, options) {
283
288
  }
284
289
 
285
290
  // Generate initial tokens.css
286
- processTokens(settings.tokensDir, settings.cssDir);
291
+ // processTokens now expects the folder where tokens.css should live
292
+ // We pass settings.cssDir, but processTokens internally joins 'tokens.css'
293
+ // So we need to point it to css/global
294
+ processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
287
295
 
288
296
  const targetLayout = settings.projectLayout;
289
297
 
@@ -430,7 +438,8 @@ function build(settings) {
430
438
 
431
439
  // 2.5 Process Tokens
432
440
  console.log("Reading JSON tokens (tokens/*.json)...");
433
- processTokens(settings.tokensDir, settings.cssDir);
441
+ // Output tokens.css to css/global/tokens.css
442
+ processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
434
443
 
435
444
  // 2.6 Generate token display HTML from JSON
436
445
  const tokensUiDir = path.join(settings.swatchkitDir, "tokens");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swatchkit",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "A lightweight tool for creating HTML pattern libraries.",
5
5
  "main": "build.js",
6
6
  "bin": {
package/src/layout.html CHANGED
@@ -9,7 +9,7 @@
9
9
  <!-- HEAD_EXTRAS -->
10
10
  </head>
11
11
  <body>
12
- <div class="sidebar">
12
+ <div class="swatchkit-ui sidebar">
13
13
  <nav class="wrapper flow">
14
14
  <header>
15
15
  <h2>SwatchKit</h2>