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

Feature: make the SCSS file importable without an improper path #244

Open
tijsmoree opened this issue Oct 12, 2022 · 4 comments
Open

Feature: make the SCSS file importable without an improper path #244

tijsmoree opened this issue Oct 12, 2022 · 4 comments
Labels
discussion Indicates that this issue / PR needs to be discussed in detail before further steps can be taken needs repro Indicates that this issue needs a reproduction before further steps can be taken

Comments

@tijsmoree
Copy link

tijsmoree commented Oct 12, 2022

I want to import the SCSS file into my own SCSS file. This is only possible using the dirty path (including ../node_modules) as @use '../../node_modules/angular-notifier/styles.scss' and not using the short-hand version @use 'angular-notifier/styles', which is the way I can import styling files of other packages.

I believe the problem here is that the styling file is called styles.scss, but there is a folder named styles as well. This dirty import could be circumvented if either of the two would be renamed. I would suggest renaming the styles file to default.scss for example.

This would of course be a breaking change.

@tijsmoree tijsmoree changed the title It is not possible to import the SCSS file properly Bug-ish: the SCSS file can only be imported using an improper path Oct 12, 2022
@tijsmoree tijsmoree changed the title Bug-ish: the SCSS file can only be imported using an improper path Feature: make the SCSS file importable without an improper path Oct 12, 2022
@H3AR7B3A7
Copy link

@import 'angular-notifier/styles';
or
@import '~angular-notifier/styles';

both work fine for me.

@tijsmoree
Copy link
Author

Okay, the weird thing is that @import 'bootstrap/scss/bootstrap'; and @import 'node_modules/bootstrap/scss/bootstrap'; both work fine (the same goes for @ng-select.

For angular-notifier, however, only @import 'node_modules/angular-notifier/styles'; works and @import 'angular-notifier/styles'; does not in my case. It gives a SassError: Can't find stylesheet to import. error. I also tried using the tilde or adding .scss to the end, but that did not make a difference and I found somewhere that the tilde has been deprecated from Angular 13 onward.

Does anyone have an explanation for this difference?

@H3AR7B3A7
Copy link

So, you are using angular 14? Is it a newly generated project? Or generated in a previous version of angular and then updated?

@tijsmoree
Copy link
Author

tijsmoree commented Oct 18, 2022

My current project was started in an older angular version, but now I tried it with a whole new configuration.

I created a new Angular 14 project using ng new with Angular CLI: 14.1.3 (ng version). Then I added "@ng-bootstrap/ng-bootstrap": "^13.1.0",, "bootstrap": "^5.2.0", and "angular-notifier": "^12.0.0", to the package.json and ran npm i. I changed the styles.scss to:

@import 'bootstrap/scss/bootstrap';
@import 'angular-notifier/styles';

When running ng serve it gives the following error:

./src/styles.scss - Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
2 │ @import 'angular-notifier/styles';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/styles.scss 2:9  root stylesheet

Adding tildes or .scss does not matter.

@dominique-mueller dominique-mueller added needs repro Indicates that this issue needs a reproduction before further steps can be taken discussion Indicates that this issue / PR needs to be discussed in detail before further steps can be taken labels Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Indicates that this issue / PR needs to be discussed in detail before further steps can be taken needs repro Indicates that this issue needs a reproduction before further steps can be taken
Projects
None yet
Development

No branches or pull requests

3 participants