Repository navigation
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already include this feature request, without success.
Describe the Feature Request
Provide a new entry to stencil.config that would allow for static analysis of @Components styleUrls.
Describe the Use Case
If you're making a component, you could provide different modes that are based on arbitrary values. All the component cares is that the styleUrl object has a key and a value.
For instance, take a component like this:
@Component({
styleUrls: {
web: 'component.web.scss',
native: 'component.native.scss'
}
})
export class MyComponent {}
While I may know styleUrls can only accept web or native as keys, the compile does not know this. Stencil's compiler could compare against a set of predefined modes that the user could pass in their config.
Describe Preferred Solution
Some solutions could be as simple as an array of strings.
export const config: Config = {
globalStyle: 'src/styles/global.scss',
modes: ['md', 'ios', ....]
}Describe Alternatives
Alternatively, you could provide an object that would specify the mode plus if it's required or not.
export const config: Config = {
globalStyle: 'src/styles/global.scss',
modes: [{mode: 'md' }, {mode: 'ios', required: true}]
}Where all modes are optional unless required is set to true.
Related Code
No response
Additional Information
No response
Activity
rwaskiewicz commentedon Dec 10, 2021
Thanks! I think this is an interesting use case that could benefit users. Labeling it for folks to upvote/add comments. Some input/thoughts I'd like from the community: