8000 GitHub - hunghg255/un-cc: A script help to create template components
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

hunghg255/un-cc

Repository files navigation

logo

A script to create a template component

NPM Version NPM Downloads Minizip Contributors License

Demo

Screen.Recording.2024-05-25.at.14.10.03.mov

Get started

npm install un-cc@latest -D

Usage

import { createComponent } from 'un-cc';

createComponent({
  staticComponentDir: 'src',
  componentDirectoryStr: ['components'],
  templatesDir: 'scripts/templates',

  transform(content, componentName) {
    return content.replaceAll('COMPONENT_NAME', 'TestComponent');
  },
});

API

type CreateComponentOptions = {
  staticComponentDir: string;
  componentDirectoryStr: string[];
  templatesDir: string;
  transform?: (content: string, componentName: string) => string;
  transformFileName?: (filename: string, componentName: string) => string;
  transformExecFile?: (componentName: string) => string;
};

Releases

No releases published

Packages

No packages published
0