@human-synthesis/norns 0.0.13 → 0.0.15

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/package.json +1 -1
  2. package/src/vite.js +13 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@human-synthesis/norns",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Norns — SvelteKit with Civet, Pug, and the .n / .civet / .c file extensions",
5
5
  "license": "MIT",
6
6
  "author": "Daniel Teodoroiu (https://humansynthesis.ai)",
package/src/vite.js CHANGED
@@ -198,17 +198,21 @@ async function walkNFiles(dir, ext, out = []) {
198
198
  * @param {object} [options]
199
199
  * @param {string} [options.root] Directory to scan (default `src`).
200
200
  * @param {string} [options.ext] File extension (default `.n`).
201
- * @param {string} [options.outFile] Sidecar path relative to root
202
- * (default `.tailwind-pug-classes.html`).
203
- * Reference it from your CSS with:
204
- * @source "./.tailwind-pug-classes.html";
201
+ * @param {string} [options.outFile] Sidecar path relative to the project
202
+ * root. The path is taken verbatim. Defaults
203
+ * to `node_modules/.cache/norns/tailwind-pug-classes.html`
204
+ * node_modules is gitignored everywhere
205
+ * and `.cache/` is the conventional spot
206
+ * for build artifacts. Reference it from
207
+ * your CSS via `@source` with a path
208
+ * relative to the importing CSS file.
205
209
  *
206
210
  * @returns {import('vite').Plugin}
207
211
  */
208
212
  export function pugTailwindExtract({
209
213
  root = 'src',
210
214
  ext = '.n',
211
- outFile = '.tailwind-pug-classes.html'
215
+ outFile = 'node_modules/.cache/norns/tailwind-pug-classes.html'
212
216
  } = {}) {
213
217
  let projectRoot = process.cwd();
214
218
  const fileClasses = new Map(); // absolute path -> Set<string>
@@ -222,7 +226,10 @@ export function pugTailwindExtract({
222
226
  const html =
223
227
  '<!-- AUTO-GENERATED by @human-synthesis/norns/vite pugTailwindExtract. Do not edit. -->\n' +
224
228
  `<div class="${sorted.join(' ')}"></div>\n`;
225
- const out = join(projectRoot, root, outFile);
229
+ // `outFile` is resolved from `projectRoot` directly; it doesn't get
230
+ // joined with `root` (the scan dir). Lets the sidecar live anywhere —
231
+ // inside src/, in a cache dir like `.norns/`, wherever.
232
+ const out = join(projectRoot, outFile);
226
233
  await mkdir(dirname(out), { recursive: true });
227
234
  await writeFile(out, html, 'utf8');
228
235
  }