swatchkit 0.2.3 → 0.3.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.
- package/build.js +27 -11
- package/package.json +1 -1
- package/src/layout.html +1 -1
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
|
-
|
|
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
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
if (fs.existsSync(
|
|
266
|
-
|
|
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
|
|
@@ -274,6 +279,13 @@ function runInit(settings, options) {
|
|
|
274
279
|
copyDir(compositionsSrc, compositionsDest);
|
|
275
280
|
}
|
|
276
281
|
|
|
282
|
+
// Copy Utilities
|
|
283
|
+
const utilitiesSrc = path.join(__dirname, "src/blueprints/utilities");
|
|
284
|
+
const utilitiesDest = path.join(settings.cssDir, "utilities");
|
|
285
|
+
if (fs.existsSync(utilitiesSrc)) {
|
|
286
|
+
copyDir(utilitiesSrc, utilitiesDest);
|
|
287
|
+
}
|
|
288
|
+
|
|
277
289
|
// Copy SwatchKit UI Styles
|
|
278
290
|
const uiSrc = path.join(__dirname, "src/blueprints/swatchkit-ui.css");
|
|
279
291
|
const uiDest = path.join(settings.cssDir, "swatchkit-ui.css");
|
|
@@ -283,7 +295,10 @@ function runInit(settings, options) {
|
|
|
283
295
|
}
|
|
284
296
|
|
|
285
297
|
// Generate initial tokens.css
|
|
286
|
-
processTokens
|
|
298
|
+
// processTokens now expects the folder where tokens.css should live
|
|
299
|
+
// We pass settings.cssDir, but processTokens internally joins 'tokens.css'
|
|
300
|
+
// So we need to point it to css/global
|
|
301
|
+
processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
|
|
287
302
|
|
|
288
303
|
const targetLayout = settings.projectLayout;
|
|
289
304
|
|
|
@@ -430,7 +445,8 @@ function build(settings) {
|
|
|
430
445
|
|
|
431
446
|
// 2.5 Process Tokens
|
|
432
447
|
console.log("Reading JSON tokens (tokens/*.json)...");
|
|
433
|
-
|
|
448
|
+
// Output tokens.css to css/global/tokens.css
|
|
449
|
+
processTokens(settings.tokensDir, path.join(settings.cssDir, "global"));
|
|
434
450
|
|
|
435
451
|
// 2.6 Generate token display HTML from JSON
|
|
436
452
|
const tokensUiDir = path.join(settings.swatchkitDir, "tokens");
|
package/package.json
CHANGED