We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm currently working with tikui on a project and I regularly have components that change depending on an element.
Example:
mixin test-button(options) -const opt = options || {} -const classList = []; -if (opt.isRed) classList.push('-red'); -if (opt.isBlue) { classList.push('-blue') }; -const classes = classList.length > 0 ? classList.join(' ') : null; button.test-button(disabled=opt.isDisabled, class=classes)
I would like to propose that we add to CLI the possibility to add options to mixin:
program .command('create <component> [destination]') .option('-p, --prefix <name>', 'prefix') .option('-mo, --mixin-options', 'add options parameter to mixin') .description('create a component.') .addHelpText('after', '\nExample:\n $ tikui create -p tikui component src/atom') .action((component, destination, options) => { createComponent(destination, component, options.prefix, options.mixinOptions); console.log(`Creating component ${component} to ${path.resolve(destination)}`); // eslint-disable-line no-console });
To get this result :
mixin test-component(options) -const opt = options || {}; -const classList = []; -const classes = classList.length > 0 ? classList.join(' ') : null; .test-component(class=classes) test-component
The createMixin function will be like this:
const createMixin = (componentDirectory: string, component: string, prefix?: string, mixinOptions?: boolean): void => { let content = `mixin ${dashPrefix(prefix)}${component}\n .${dashPrefix(prefix)}${component} ${component}\n`; if(mixinOptions){ content = `mixin ${dashPrefix(prefix)}${component}(options) -const opt = options || {}; -const classList = []; -const classes = classList.length > 0 ? classList.join(' ') : null; .${dashPrefix(prefix)}${component}(class=classes) ${component}\n`; } const file = `${component}.mixin.pug`; createFile(componentDirectory, file); fs.writeFileSync(path.resolve(componentDirectory, file), content); };
What do you think ?
The text was updated successfully, but these errors were encountered:
You can propose a PR for it, i'm not sure -mo will work because multiple characters options needs two dash.
-mo
I've no idea if it will be really useful for Tikui users but let's try.
I know there is also a lack of documentation.
(On your PR, don't forget to refactor when needed ;) )
Sorry, something went wrong.
No branches or pull requests
I'm currently working with tikui on a project and I regularly have components that change depending on an element.
Example:
I would like to propose that we add to CLI the possibility to add options to mixin:
To get this result :
The createMixin function will be like this:
What do you think ?
The text was updated successfully, but these errors were encountered: