swatchkit 0.2.3 → 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 +20 -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
|
|
@@ -283,7 +288,10 @@ function runInit(settings, options) {
|
|
|
283
288
|
}
|
|
284
289
|
|
|
285
290
|
// Generate initial tokens.css
|
|
286
|
-
processTokens
|
|
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
|
-
|
|
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