@elrond25/theme-generator
v1.0.1
Published
This package generates a CSS file from a theme object.
Readme
Theme Generator
A simple CLI tool that reads a theme object from a JS/TS module and generates a CSS file with custom properties.
Prerequisites
Installation
- Clone or download this repository
- From the project root, install dependencies:
npm installUsage
Build via npm script
A convenience script is provided in package.json:
npm run build
# which runs: tsx index.ts theme.js src/theme.css- theme.js – path to your theme module (must export a default object)
- src/theme.css – path where the generated CSS will be written
Direct CLI invocation
Make the script executable and run it directly:
chmod +x index.ts
./index.ts <input-theme-module> <output-css-file>Example
./index.ts theme.js src/theme.cssHelp & Version
# Show help
index.ts --help
# Show version
index.ts --versiontheme.js format
Your theme module must export a default object:
// theme.js
export default {
primary: '#3490dc',
secondary: {
DEFAULT: '#ffed4a',
dark: '#f9d71c'
},
// ... more keys/nested objects
}Nested objects will be flattened to CSS variables like:
:root {
--primary: #3490dc;
--secondary: #ffed4a;
--secondary-dark: #f9d71c;
}License
MIT
