Skip to content
New issue

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

Implicit component file name customisation #135

Open
robertjk opened this issue Sep 26, 2018 · 2 comments
Open

Implicit component file name customisation #135

robertjk opened this issue Sep 26, 2018 · 2 comments

Comments

@robertjk
Copy link

robertjk commented Sep 26, 2018

Can you provide a way to customise the way a component name is implied from the file name?

I'm having an Angular project in which I'd like to use your plugin. In Angular it's recommended to name the stylesheet for SomeThing component some-thing.component.scss.

This plugin then throws an error Invalid component name from implicit conversion from filename (...)/src/app/shared/some-thing/some-thing.component.scss. I assume the problem is that after removing the extension .scss the plugin is left with some-thing.component which has dot in it, which it doesn't know how to handle.

  1. An easy way to fix that would be to add a configuration option, which would specify a suffix added to component files. E.g.:
    implicitComponentsSuffix: '.component'
  2. More flexible solution would be to use a regular expression, which would define how component name is found in the file name (with extension removed). The capture group in that regular expression extracts the component name. E.g.:
    implicitComponentsNameExtract: /^(.+)\.component$/

Is there a chance to provide an option to configure that?

@simonsmith
Copy link
Collaborator

Just looking at this now. The Regex option could be a good route to go. In this example though, what should happen if I had a regex and extracted some-thing from some-thing.component.scss and tried to match it against SomeThing. This would still fail currently.

@amk221
Copy link

amk221 commented Sep 17, 2019

+1 for Ember land

/components/foo           <----
    /index.hbs
    /index.js
    /index.scss

So in the above example, I would like to auto-define foo as the stylesheet namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants