swatchkit 0.9.0 → 0.9.2

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/README.md +35 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -381,6 +381,41 @@ In watch mode, SwatchKit detects when its output directory is deleted by an exte
381
381
 
382
382
  SwatchKit only ever writes inside its own output subdirectory — it will never modify or delete other files in `dist/`.
383
383
 
384
+ ### Example: Custom Build Pipeline
385
+
386
+ If you are rolling your own build system (e.g. using `onchange` to copy files), use a tool like `npm-run-all` to run your watchers in parallel.
387
+
388
+ **swatchkit.config.js**
389
+
390
+ ```javascript
391
+ module.exports = {
392
+ cssDir: "./src/css",
393
+ cssCopy: false, // Don't copy CSS (your build tool handles it)
394
+ };
395
+ ```
396
+
397
+ **package.json**
398
+
399
+ ```json
400
+ {
401
+ "scripts": {
402
+ "build": "rm -rf dist && mkdir -p dist && cp -r src/ dist/",
403
+ "swatchkit": "swatchkit",
404
+ "swatchkit:watch": "swatchkit --watch",
405
+ "dev:app": "onchange 'src/**/*' -- npm run build",
406
+ "dev": "npm-run-all --parallel dev:app swatchkit:watch"
407
+ },
408
+ "devDependencies": {
409
+ "npm-run-all": "^4.1.5",
410
+ "onchange": "^7.1.0"
411
+ }
412
+ }
413
+ ```
414
+
415
+ ### Watch mode and file watchers
416
+
417
+ SwatchKit generates files into your source tree during each build — CSS token files (`css/global/tokens.css`, `css/utilities/tokens.css`) and token documentation HTML (`swatchkit/tokens/*.html`). To avoid triggering external file watchers unnecessarily, SwatchKit compares generated content against the existing file and **skips the write when nothing has changed**. This means most rebuilds (e.g., editing an HTML swatch) won't touch your CSS directory at all, preventing infinite rebuild loops when running alongside tools like `onchange`, `chokidar`, or framework dev servers that watch `src/`.
418
+
384
419
  ## Acknowledgements
385
420
 
386
421
  The CSS compositions included by default in SwatchKit are adapted from [Every Layout](https://every-layout.dev/) by Heydon Pickering and Andy Bell. Highly recommend their documentation for a deep dive into their brilliant CSS techniques.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swatchkit",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "A lightweight tool for creating HTML pattern libraries.",
5
5
  "main": "build.js",
6
6
  "bin": {