resources-utilities
A command line and library to generate typescript definition file from CSS, SASS, SCSS or SVG file.
Install
Using NPM
npm i -D @krobkrong/resources-utilities
Using Yarn
yarn add @krobkrong/resources-utilities -D
Command Line Usage
Resource utilities provide a command line that accept the last argument with glob pattern input syntax. For example, the command line below will generate a typescript definition file from a CSS file in the current work directory:
resutil theme*.css
If you've a specific location to store typescript definition file then you can use output directory option:
resutil -o types theme*.css
The command above will generate the typescript definition file in the folder types in the current working directory.
For more information run resutil --help
APIs Usage
Resource utilities provided APIs for both CSS and SVG. The below code utilize StyleUtils
namespace to parse raw css file:
import { StyleUtils } from "@krobkrong/resources-utilities";
let resource = StyleUtils.parse(raw, {
convension: "camel",
cssClass: true,
cssId: true,
cssVariable: true
})