swatchkit 0.9.1 → 0.9.3
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 +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -381,6 +381,37 @@ 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
|
+
|
|
384
415
|
### Watch mode and file watchers
|
|
385
416
|
|
|
386
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/`.
|