css-comments-to-json 0.1.0 → 0.1.1

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 +34 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -195,6 +195,23 @@ const result = await generateStyleguideData({
195
195
  console.log(result.warnings);
196
196
  ```
197
197
 
198
+ ## Notes
199
+
200
+ This package extracts `@sg-` tags from CSS-compatible block comments (`/* ... */`). It can also be used with SCSS or PostCSS source files as long as the comments use that format.
201
+
202
+ ```sh
203
+ npx css-comments-to-json \
204
+ --input "src/**/*.{css,scss,pcss}" \
205
+ --output "src/_data" \
206
+ --prefix styleguide
207
+ ```
208
+
209
+ SCSS line comments such as `// @sg-name` are not parsed.
210
+
211
+ The parser is intentionally lightweight. It reports warnings for incomplete comment blocks, but it does not validate Markdown table syntax. Table content is passed through as text.
212
+
213
+ Custom project-specific tags are not supported yet. The current implementation supports the documented `@sg-` tags only.
214
+
198
215
  ## Eleventy
199
216
 
200
217
  Use the CLI before Eleventy builds:
@@ -401,6 +418,23 @@ const result = await generateStyleguideData({
401
418
  console.log(result.warnings);
402
419
  ```
403
420
 
421
+ ### 補足
422
+
423
+ このパッケージは、CSS 互換のブロックコメント(`/* ... */`)から `@sg-` タグを抽出します。そのため、SCSS や PostCSS 用のファイルでも、この形式のコメントが書かれていれば利用できます。
424
+
425
+ ```sh
426
+ npx css-comments-to-json \
427
+ --input "src/**/*.{css,scss,pcss}" \
428
+ --output "src/_data" \
429
+ --prefix styleguide
430
+ ```
431
+
432
+ SCSS の `// @sg-name` のような行コメントはパース対象外です。
433
+
434
+ パーサは意図的に軽量にしています。不完全なコメントブロックには warning を出しますが、Markdown テーブルの構文までは検証しません。テーブルの内容は文字列としてそのまま出力します。
435
+
436
+ プロジェクト固有の独自タグは、現時点では未対応です。現在は README に記載している `@sg-` タグのみをサポートしています。
437
+
404
438
  ### Eleventy で使う
405
439
 
406
440
  Eleventy のビルド前に CLI を実行します。
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "css-comments-to-json",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Generate styleguide JSON data from CSS comments.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "masizime",
8
8
  "sideEffects": false,
9
9
  "bin": {
10
- "css-comments-to-json": "./src/cli.js"
10
+ "css-comments-to-json": "src/cli.js"
11
11
  },
12
12
  "exports": {
13
13
  ".": "./src/index.js"