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

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

Closed
JeanOsorio opened this issue Jan 22, 2020 · 11 comments · Fixed by ionic-team/ionic-framework#29666
Closed
Assignees
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.

Comments

@JeanOsorio
Copy link

Stencil version:

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

@ionitron-bot ionitron-bot bot added the triage label Jan 22, 2020
@JeanOsorio
Copy link
Author

I would like to make a PR for this feature, could someone asign me this issues. Thanks in advance

@romulocintra
Copy link
Contributor

romulocintra commented Jan 22, 2020

Hi @JeanOsorio ,

Do you have npm install @stencil/sass --save-dev that was made to support this use case.

Please have at look a Plugins documentation https://stenciljs.com/docs/plugins

@JeanOsorio
Copy link
Author

JeanOsorio commented Jan 22, 2020

Hello @romulocintra I’ve already install the sass plugin, all my components work with sass files, but I have to manually change from .css to .scss, so my proposal is to generate a component with a scss instead of css

@Drohno
Copy link

Drohno commented Jan 22, 2020

I totally agree with @JeanOsorio. With the actual capabilities of StencilJS a thing as simple as create a new component using SASS from the beginning it is a no way man feature (not able to do so).
Otherwise as @romulocintra states, it can process sass to css and then do whatever you please with ease, but it is a pain in the head to manually change each time from css to sass when creating a new component.

@romulocintra
Copy link
Contributor

romulocintra commented Jan 22, 2020

I believe the core architecture based on plugins intends to be optioned and pluggable, adding this probably would go against it and open different threads about:

  • Why not support sass/less/stylus +
  • Extra weight if you mean add the plugin to the core

Having this in generation process as option or parameter of the CLI would be more recommended, always checking if plugin exist or installed and probably accepting as many options as plugins. Or give support for custom templates

@Drohno
Copy link

Drohno commented Jan 22, 2020

That is @romulocintra exactly my point of view about this.
If you have installed the sass plugin of stencil, your cli should have the ability to create scss instead of css files

@max-scopp
Copy link

You can use vscode Stencil tools in the meantime, you can configure the extensions.

@diegolsarmiento
Copy link

Just to be aware: The extension in VS generates e2e file inside the component folder ('npm run generate' creates 'test' folder and inside spec and e2e files).

@tanner-reits
Copy link
Member

Hi all 👋

I think this could be a nice addition we add in the future. To feel effective, however, seems like we would need to make some related changes to how our started projects are created for this to be useful end-to-end. I'll put a label on here so this can get ingested into our backlog for future refinement. Keep an eye here for future updates!

@tanner-reits tanner-reits added Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through. and removed triage labels Sep 2, 2022
@christian-bromann christian-bromann self-assigned this Jun 25, 2024
@christian-bromann
Copy link
Member

Implemented in #5857

@tanner-reits
Copy link
Member

This was included in today's v4.19.0 release!

github-merge-queue bot pushed a commit to ionic-team/ionic-framework that referenced this issue Jun 26, 2024
### Release Notes

<details>
<summary>ionic-team/stencil (@&#8203;stencil/core)</summary>

###
[`v4.19.0`](https://togithub.com/ionic-team/stencil/blob/HEAD/CHANGELOG.md#-4190-2024-06-26)

[Compare
Source](https://togithub.com/ionic-team/stencil/compare/v4.18.3...v4.19.0)

### Bug Fixes

* **compiler:** support rollup's external input option
([#3227](ionic-team/stencil#3227))
([2c68849](ionic-team/stencil@2c68849)),
fixes [#3226](ionic-team/stencil#3226)
* **emit:** don't emit test files
([#5789](ionic-team/stencil#5789))
([50892f1](ionic-team/stencil@50892f1)),
fixes [#5788](ionic-team/stencil#5788)
* **hyrdate:** support vdom annotation in nested dsd structures
([#5856](ionic-team/stencil#5856))
([61bb5e3](ionic-team/stencil@61bb5e3))
* label attribute not toggling input
([#3474](ionic-team/stencil#3474))
([13db920](ionic-team/stencil@13db920)),
fixes [#3473](ionic-team/stencil#3473)
* **mock-doc:** expose ShadowRoot and DocumentFragment globals
([#5827](ionic-team/stencil#5827))
([98bbd7c](ionic-team/stencil@98bbd7c)),
fixes [#3260](ionic-team/stencil#3260)
* **runtime:** allow watchers to fire w/ no Stencil members
([#5855](ionic-team/stencil#5855))
([850ad4f](ionic-team/stencil@850ad4f)),
fixes [#5854](ionic-team/stencil#5854)
* **runtime:** catch errors in async lifecycle methods
([#5826](ionic-team/stencil#5826))
([87e5b33](ionic-team/stencil@87e5b33)),
fixes [#5824](ionic-team/stencil#5824)
* **runtime:** don't register listener before connected to DOM
([#5844](ionic-team/stencil#5844))
([9d7021f](ionic-team/stencil@9d7021f)),
fixes [#4067](ionic-team/stencil#4067)
* **runtime:** properly assign style declarations
([#5838](ionic-team/stencil#5838))
([5c10ebf](ionic-team/stencil@5c10ebf))
* **testing:** allow to re-use pages across it blocks
([#5830](ionic-team/stencil#5830))
([561eab4](ionic-team/stencil@561eab4)),
fixes [#3720](ionic-team/stencil#3720)
* **typescript:** remove unsupported label property
([#5840](ionic-team/stencil#5840))
([d26ea2b](ionic-team/stencil@d26ea2b)),
fixes [#3473](ionic-team/stencil#3473)


### Features

* **cli:** support generation of sass and less files
([#5857](ionic-team/stencil#5857))
([1883812](ionic-team/stencil@1883812)),
closes [#2155](ionic-team/stencil#2155)
* **compiler:** generate export maps on build
([#5809](ionic-team/stencil#5809))
([b6d2404](ionic-team/stencil@b6d2404))
* **complier:** support type import aliasing
([#5836](ionic-team/stencil#5836))
([7ffb25d](ionic-team/stencil@7ffb25d)),
closes [#2335](ionic-team/stencil#2335)
* **runtime:** support declarative shadow DOM
([#5792](ionic-team/stencil#5792))
([c837063](ionic-team/stencil@c837063)),
closes [#4010](ionic-team/stencil#4010)
* **testing:** add `toHaveLastReceivedEventDetail` event spy matcher
([#5829](ionic-team/stencil#5829))
([63491de](ionic-team/stencil@63491de)),
closes [#2488](ionic-team/stencil#2488)
* **testing:** allow to disable network error logging via
'logFailingNetworkRequests' option
([#5839](ionic-team/stencil#5839))
([dac3e33](ionic-team/stencil@dac3e33)),
closes [#2572](ionic-team/stencil#2572)
* **testing:** expose captureBeyondViewport in pageCompareScreenshot
([#5828](ionic-team/stencil#5828))
([cf6a450](ionic-team/stencil@cf6a450)),
closes [#3188](ionic-team/stencil#3188)

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Refine This PR is marked for Jira refinement. We're not working on it - we're talking it through.
Projects
None yet
7 participants