-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Component generation regression - files/folders include 'app-' prefix #2347
Comments
I was surprised this had changed and don't know if it is a suggested pattern change or a mistake. |
This is expected behaviour, we will update thee style guide. it's not a breaking changee though! |
@manucorporat thanks for the reply! What's the motivation behind the change? Ionic Core components aren't referenced like this (https://github.com/ionic-team/ionic/tree/master/core/src/components). I assume the generator wasn't used to make these but if all these files and folders had 'ion-' prefixed it'd make the list harder to read through. I also don't believe other CLIs, such as Angular CLI, add the prefix when generating components. |
The prefix is a key in web components, while it's not for angular, or other frameworks, we found cases where people had different prefixes under the same collection, and sometimes that makes sense, for different teams, or really big apps. In addition it was a lot of extra complexity in the generator code to "remove" what looks like a prefix, when sometimes it was not even a prefix. Going forward we will recomment to have the name of the component, ie the tagname which as single source of truth! |
Just to confirm;
The tag inside The new structure is:
Additionally, if I ran
therefore cannot apply because if I want to just generate, for example, a We have a project with 100s of components, so forcing the In Angular CLI you can specify a prefix, which gets attached to all classes and tags but isn't applied to the file and folder names. I can't imagine there's complexity in removing the This change makes the CLI non-fit for purpose for ourselves, and even the Ionic Core codebase, as the new pattern moves away from how the components have been created there. Sorry that's a bit long-winded over something fairly trivial, but just wanted to provide some clear feedback |
IMHO, the web component prefix should really be separate from the component name. It would be generated like this:
Neither of the above, ideally, should create unnecessarily long file names. The web components prefix should not be part of the file/folder name. This could be re-activated with an additional flag, e.g. --keep-prefix These would be conditions in place where the strings for the file/folder names of the new component are being concatenated. Not too much complexity. If that is not the case, could you elaborate more, where the additional complexity would be? |
Stencil version:
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
npx stencil generate app-component
creates files/folders withapp-
prefixExpected behavior:
Files/folders created without
app-
prefixSteps to reproduce:
Run
npx stencil generate app-component
Related code:
Other information:
In version, maybe, 1.5 it used to work the current way where
app-
was prefixed to files and folders when generating components from the CLI. This was removed in later versions. We were most recently using v1.8 and generating components without theapp-
prefix.Without
app-
is preferred as it makes it easier to read component files and folders without having to ignore that prefix in file/folder structure.We've updated to 1.12.1 and now
app-
is being prefixed to files/folders.The text was updated successfully, but these errors were encountered: