swatchkit 0.3.0 → 0.5.0

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.
Files changed (2) hide show
  1. package/build.js +12 -3
  2. package/package.json +1 -1
package/build.js CHANGED
@@ -2,7 +2,7 @@
2
2
  const fs = require("fs");
3
3
  const path = require("path");
4
4
  const chokidar = require("chokidar");
5
- const { processTokens } = require("./src/tokens");
5
+ const { processTokens, generateTokenUtilities } = require("./src/tokens");
6
6
  const { generateTokenSwatches } = require("./src/generators");
7
7
 
8
8
  /**
@@ -298,7 +298,11 @@ function runInit(settings, options) {
298
298
  // processTokens now expects the folder where tokens.css should live
299
299
  // We pass settings.cssDir, but processTokens internally joins 'tokens.css'
300
300
  // So we need to point it to css/global
301
- processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
301
+ const tokensContext = processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
302
+
303
+ if (tokensContext) {
304
+ generateTokenUtilities(tokensContext, path.join(settings.cssDir, "utilities"));
305
+ }
302
306
 
303
307
  const targetLayout = settings.projectLayout;
304
308
 
@@ -446,7 +450,12 @@ function build(settings) {
446
450
  // 2.5 Process Tokens
447
451
  console.log("Reading JSON tokens (tokens/*.json)...");
448
452
  // Output tokens.css to css/global/tokens.css
449
- processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
453
+ const tokensContext = processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
454
+
455
+ // Generate Utilities to css/utilities/tokens.css
456
+ if (tokensContext) {
457
+ generateTokenUtilities(tokensContext, path.join(settings.cssDir, "utilities"));
458
+ }
450
459
 
451
460
  // 2.6 Generate token display HTML from JSON
452
461
  const tokensUiDir = path.join(settings.swatchkitDir, "tokens");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swatchkit",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "A lightweight tool for creating HTML pattern libraries.",
5
5
  "main": "build.js",
6
6
  "bin": {