mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-23 13:43:11 +02:00
Try a new approach
This commit is contained in:
22
build/glossary.mjs
Normal file
22
build/glossary.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as path from 'path';
|
||||
import { argv } from 'node:process';
|
||||
import * as fs from 'fs/promises';
|
||||
import { getCssClasses } from './getCssClasses.mjs';
|
||||
|
||||
try {
|
||||
const args = argv.slice(2);
|
||||
|
||||
const fileClasses = await getCssClasses(args[0]);
|
||||
|
||||
const outputFilePath = args[1] ?? `${path.parse(args[0]).name}.json`
|
||||
|
||||
await fs.writeFile(outputFilePath, JSON.stringify(fileClasses))
|
||||
}
|
||||
catch (error) {
|
||||
// console.log(error)
|
||||
// TODO: inputPath could be an HTTP link
|
||||
console.log(`Usage: node glossary.mjs <inputPath> <outputPath>
|
||||
- inputPath: CSS file to parse
|
||||
- outputPath: JSON file (optional). Default value is: <inputPath>.json
|
||||
`)
|
||||
}
|
Reference in New Issue
Block a user