Skip to content

Allow generate new component with scss file instead of css #2155

@JeanOsorio

Description

@JeanOsorio

Stencil version:

 @stencil/core@1.8.4

I'm submitting a:

[ ] bug report
[x ] 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:
Can generate a new component with scss file instead of css

Expected behavior:
allow to generate a new component with a scss file and with the css file inside decorator

Steps to reproduce:
npm run generate

✔ Component tag name (dash-case): … my-component
✔ Which additional files do you want to generate? › Stylesheet, Spec Test, E2E Test

$ stencil generate super-component

The following files have been generated:

  • src/components/component/my-component.tsx
  • src/components/component/my-component.css
  • src/components/component/my-component.spec.ts
  • src/components/component/my-component.e2e.ts

Related code:

import { Component, Prop, h } from '@stencil/core';
import { format } from '../../utils/utils';

@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css', 
  shadow: true
})
export class MyComponent {
  /**
   * The first name
   */
  @Prop() first: string;

  /**
   * The middle name
   */
  @Prop() middle: string;

  /**
   * The last name
   */
  @Prop() last: string;

  private getText(): string {
    return format(this.first, this.middle, this.last);
  }

  render() {
    return <div>Hello, World! I'm {this.getText()}</div>;
  }
}

Other information:
Here is the suggestion of simonhaenisch on slack https://stencil-worldwide.slack.com/archives/C79EANFL7/p1579693868137100

Metadata

Metadata

Labels

Resolution: RefineThis PR is marked for Jira refinement. We're not working on it - we're talking it through.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions