stencil icon indicating copy to clipboard operation
stencil copied to clipboard

feat(cli): Add ability to specify component generation config parameters

Open nathanb21 opened this issue 5 years ago • 3 comments

A user can define a prefix and styleFormat parameter in stencil.config.ts to provide more flexibility when working with the stencil generate CLI command.

eg.

import { Config } from '@stencil/core';

export const config: Config = {
...
  componentGeneratorConfig: {
    prefix: 'ion',
    styleFormat: 'scss'
  }
}

The toggle prompts remain the same, referencing scss instead of css in the above example.

This object is optional, with a default app prefix and css format being applied.

Generated files and folders are created without the prefix within the name. Eg. ion-button component would create file/folder structure button, button.tsx etc.

The generation command would change to:

npx stencil generate button instead of npx stencil generate ion-button

Resolves: https://github.com/ionic-team/stencil/issues/2303 https://github.com/ionic-team/stencil/issues/2347 https://github.com/ionic-team/stencil/issues/2348 https://github.com/ionic-team/stencil/issues/2396

nathanb21 avatar May 08 '20 10:05 nathanb21

I could remove the default application of app- if we didn't want to force a default on users, then the functionality would remain much the same as current. Let me know your thoughts :)

nathanb21 avatar May 08 '20 11:05 nathanb21

Are there any plans to move forward on this PR?

prodkt avatar Apr 15 '22 04:04 prodkt

This would be a great help for our projects, too. Writing the tag names/prefixes manually comes always with the possibility of human error...

noopliez avatar Apr 20 '22 12:04 noopliez