Skip to content

Comments

feat: replace scss imports with @use#615

Merged
spike-rabbit merged 1 commit intosiemens:mainfrom
Franiac:fix/replace-scss-imports
Feb 24, 2026
Merged

feat: replace scss imports with @use#615
spike-rabbit merged 1 commit intosiemens:mainfrom
Franiac:fix/replace-scss-imports

Conversation

@Franiac
Copy link

@Franiac Franiac commented Feb 5, 2026

What kind of change does this PR introduce? (check one with "x")

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

Issue #613

What is the new behavior?

  • Uses @use instead of @import for scss references
  • Fixed the docs since index.css does not exist anymore

Does this PR introduce a breaking change? (check one with "x")

  • Yes
  • No

If this PR contains a breaking change, please describe the impact and migration path for existing applications:

  • $disable-row-text-color scss variable was renamed to $datatable-disable-row-text-color.
  • $datatble-ghost-cell-animation-duration was renamed to $datatable-ghost-cell-animation-duration.

Both changes only affect the material and bootstrap theme.

Other information:

@Franiac Franiac requested a review from a team as a code owner February 5, 2026 10:13
@CLAassistant
Copy link

CLAassistant commented Feb 5, 2026

CLA assistant check
All committers have signed the CLA.

@gemini-code-assist
Copy link

Summary of Changes

Hello @Franiac, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request modernizes the project's SCSS codebase by migrating from the deprecated @import rule to the contemporary @use rule. This transition improves stylesheet management by preventing global namespace pollution and enhancing maintainability. Additionally, it updates relevant documentation to reflect these changes and removes references to a no-longer-existing index.css file.

Highlights

  • SCSS Module System Migration: Replaced all instances of the deprecated @import rule with the modern @use rule across various SCSS files, aligning with current Sass module system best practices.
  • Documentation Update: Updated the docs/introduction/themes.md file to reflect the new @use syntax and removed references to the index.css file, which is no longer in use.
  • Removed Obsolete CSS Import: Eliminated imports of index.css from theme files, as this file is no longer necessary for the project's styling.
Changelog
  • docs/introduction/themes.md
    • Updated SCSS code snippets to use @use instead of @import for material.scss and icons.css.
    • Removed the @import '~@siemens/ngx-datatable/index.css'; line.
  • projects/ngx-datatable/src/lib/themes/bootstrap.scss
    • Changed @import './ghost'; to @use './ghost';.
    • Changed @import './rows'; to @use './rows';.
  • projects/ngx-datatable/src/lib/themes/material.scss
    • Updated SCSS code snippets in comments to use @use instead of @import for material.scss and icons.css.
    • Removed the @import '~@siemens/ngx-datatable/index.css'; line from comments.
    • Changed @import './ghost'; to @use './ghost';.
    • Changed @import './rows'; to @use './rows';.
  • src/styles.scss
    • Changed @import '../projects/ngx-datatable/src/lib/themes/material'; to @use '../projects/ngx-datatable/src/lib/themes/material';.
    • Changed @import '../projects/ngx-datatable/src/lib/themes/dark'; to @use '../projects/ngx-datatable/src/lib/themes/dark';.
    • Changed @import '../projects/ngx-datatable/src/lib/themes/bootstrap'; to @use '../projects/ngx-datatable/src/lib/themes/bootstrap';.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modernizes the SCSS by replacing the @import rule with @use. While this is a good practice for SCSS files, I've noticed that @use has been incorrectly applied to plain CSS files. The @use rule is specifically for Sass files; for CSS files, the standard @import should be used. I've provided suggestions to correct this in the relevant files.

@fh1ch fh1ch added the bug Something isn't working label Feb 19, 2026
@fh1ch fh1ch force-pushed the fix/replace-scss-imports branch from 87a18c5 to 387cbe2 Compare February 19, 2026 18:22
Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contribution 🚀 , and sorry for the long response time. I was recently very busy with our main project.

Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is perfect 💯 .

Can you please squash all your commits into one.
Since you renamed one variable please also add a breaking change note. We anyway will do a major release soon so the breaking change is not a problem.

I think we should actually use a feat instead of fix. It is not really a bug you are fixing here.

In case you don't write to write the message on your own, just copy mine:


feat: replace scss @import with @use

BREAKING CHANGE: $disable-row-text-color scss variable was renamed to $datatable-disable-row-text-color. This only affects the material and bootstrap theme.

Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After seeing the compiler error, maybe just convert rows.scss and / ghost.scss to mixins/functions. Then they can also be properly scoped for a theme.

@Franiac Franiac changed the title fix: replace scss imports with @use feat: replace scss imports with @use Feb 23, 2026
@Franiac
Copy link
Author

Franiac commented Feb 23, 2026

Did the mixin thing, looks way cleaner (no double variable declarations) and works. I hope I did that correctly.

I also renamed a second variable $datatble-ghost-cell-animation-duration (missing 'a') to $datatable-ghost-cell-animation-duration and updated the PR description above accordingly.

Since I merged main into my branch between the commits to be up2date, I cannot squash my commits. I recommend just squashing when merging the PR, that should then work.

And I just want to thank you for maintaining the project. I updated a very old Angular 8 app to 21, updated from swimlane/ngx-datatable to siemens and it just worked. I am super happy about it because first I looked at swimlane, realized it is abandoned and thought "shit, I have to replace the entire datatable component". You saved me a lot of work.

@spike-rabbit spike-rabbit force-pushed the fix/replace-scss-imports branch from 4200a17 to e669198 Compare February 23, 2026 16:28
@spike-rabbit
Copy link
Member

Seem like this actually changed some styling. In case you did not figure out already:
You can download the E2E results with this: gh run download 22315116213 -D dist/scss-run (-D just sets the target directory, and dist is ignored by git so I always use that).

Then you can server the PW report with npx http-server dist/scss-run/e2e-results/preview/

Haha, we had basically the same issue as you with the swimlane version. In general we plan to also go beyond basic maintenance and really fix some annoying issues.

@Franiac
Copy link
Author

Franiac commented Feb 23, 2026

I have to do some debugging to see what's causing the differences. Looks like a slight change in font color in the paging part.

@Franiac
Copy link
Author

Franiac commented Feb 23, 2026

I figured it out and relized an extremely dangerous thing that the current e2e test would not even catch:

I changed @import to @use in the main styles.scss. This destroys all connections to globally defined variables

$datatable-.....: value;    <------- that does nothing right now anymore!!!

@use '../projects/ngx-datatable/src/lib/themes/material';
@use '../projects/ngx-datatable/src/lib/themes/dark';
@use '../projects/ngx-datatable/src/lib/themes/bootstrap';

Like we attempred with ghost.scss and rows.scss we would need to go with:

@use '../projects/ngx-datatable/src/lib/themes/material' with (... every variable in material.scss using !default ...);
@use '../projects/ngx-datatable/src/lib/themes/dark' with  (... every variable in dark.scss using !default ...);
@use '../projects/ngx-datatable/src/lib/themes/bootstrap' with (... every variable in bootstrap.scss using !default ...);

So basically I would have destroyed every custom theme that users defined in styles.scss. I really really dislike the !default approach and I think I now know why I never saw it before in my life (I am a 41 year old dev, so I saw "some" stuff). I am switching more and more towards CSS variables because those can be also set at runtime which is a major benefit over compiled SCSS variables.

So what do you think? I mean it wouldn't be a big thing to include all the variables in the with (...) statement and roll with it. It woulnd't break the user's themes (made by overriding SCSS variables). But before I do that I want to have your "go for it".

Maybe we should introduce an e2e test that builds a user-theme that defines some variables in styles.scss before the main @use statements to verify those values are actually getting used in the compiled CSS. This really is a bad trap to fall in.

@Franiac
Copy link
Author

Franiac commented Feb 23, 2026

I checked the docs again and found this:

https://siemens-com.gitbook.io/ngx-datatable/readme/themes

So basically that tells users to theme their tables with the mentioned CSS classes, not by overriding SCSS variables, which makes the whole !default declarations irrelevant. Nobody would go into the material.scss in order to get a list of SCSS variables to override and theme their table that way.

So a very basic question would be: Do we really need !default declarations and would removing them actually break anything? They are only used in bootstrap.scss and material.scss obviously.

@spike-rabbit
Copy link
Member

The theming is one of the things which will get some changes. At least for our theme we had to do a lot of deep overrides which we want to replace.

But I think for now just marginal changes are fine. Removing !default would be breaking as someone could be using those pre-built themes and maybe override variables. So leaving the !default for now to avoid breaking changes is fine.

Once we started working on a theming overhaul, we will also introduce proper testing. But for now getting rid of the compiler warnings is fine.

Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess since those are anyway mixins you can move them inside the "theme".
Please do the same for the ghost ones as well. I guess after that one I can merge.

@Franiac
Copy link
Author

Franiac commented Feb 24, 2026

We should be good now 😄

BREAKING CHANGE: Renamed SCSS variables:
- `$disable-row-text-color` to `$datatable-disable-row-text-color`
- `$datatble-ghost-cell-animation-duration` to `$datatable-ghost-cell-animation-duration`

This only affects the material and bootstrap theme.
@spike-rabbit spike-rabbit force-pushed the fix/replace-scss-imports branch from 5a4b578 to 30dcb7f Compare February 24, 2026 12:54
Copy link
Member

@spike-rabbit spike-rabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you a lot again ❤️ . Now everything should be fine. I just squashed your commits and will merge them now.

@spike-rabbit spike-rabbit enabled auto-merge (rebase) February 24, 2026 12:55
@Franiac
Copy link
Author

Franiac commented Feb 24, 2026

Well, that took way more effort than I anticipated 😄

But I am glad the project exists and I can help. There are several compile warnings still. I'll take a look at those, too.

@spike-rabbit spike-rabbit merged commit 14073de into siemens:main Feb 24, 2026
3 checks passed
@Franiac Franiac deleted the fix/replace-scss-imports branch February 24, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants