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

Add support for css variables to mixin #497

Merged
merged 4 commits into from
May 30, 2024
Merged

Add support for css variables to mixin #497

merged 4 commits into from
May 30, 2024

Conversation

HanneloreVerbraekel
Copy link
Contributor

While migrating from scss to css variables, we bumped into some issues with the ember power calendar mixin:

codeFrame: Error: Undefined operation "calc(32px + var(--our-variable)) * 1". ╷ 128 │ padding-left: $cell-with-spacing-width * 1; │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ /tmp/broccoli-474vURcC73g1RJ/out-944-funnel_funnel_styles/app/styles/ember-power-calendar.scss 128:21 ember-power-calendar()

This code would make it possible to use css variables in the scss variables needed for the ember power calendar mixin.

@mkszepp
Copy link
Collaborator

mkszepp commented May 28, 2024

@HanneloreVerbraekel Looking at the generated css output it looks like the mixin part is missing in css. Atm we use the ember-power-calendar.scss to generate that, but i think we need an other one to generate the clean css... This we should fix.

I'm not sure, but are you using the scss file in css?
If you are using vanilla css you should use the import like import 'ember-power-calendar/styles'; in application.js or @import 'ember-power-calendar/vendor/ember-power-calendar.css'; in any css file. See https://ember-power-calendar.com/docs/installation

For add css variable support i think, we need a complete new file (maybe we can do this while rollup, so that we don't need to add a fix css file inside the repo)

@HanneloreVerbraekel
Copy link
Contributor Author

Hi! We are using css variables in an .scss file. I can test the code with our old scss variables?

@mkszepp
Copy link
Collaborator

mkszepp commented May 28, 2024

Ah... if i have understand correctly you are passing in a variable like $cell-width a css variable

Example: $cell-width: var(--cell-width) right?

@HanneloreVerbraekel
Copy link
Contributor Author

Ah... if i have understand correctly you are passing in a variable like $cell-width a css variable

Example: $cell-width: var(--cell-width) right?

Correct!

@mkszepp
Copy link
Collaborator

mkszepp commented May 29, 2024

Whats the benefit to use css variables inside scss?

What do you think about a extra file, which is place css, with css variables?

@HanneloreVerbraekel
Copy link
Contributor Author

We provide them through our design system. The implementation is scss.

@mkszepp
Copy link
Collaborator

mkszepp commented May 29, 2024

@HanneloreVerbraekel can you apply the same code changes also to the less file? So we have same behavior in scss & less

@HanneloreVerbraekel
Copy link
Contributor Author

Hi! I added it. Can you thorougly check it, though? This is my first time using less!

@mkszepp
Copy link
Collaborator

mkszepp commented May 29, 2024

Hi! I added it. Can you thorougly check it, though? This is my first time using less!

thank you, little syntax error, the rest looks good. Can you fix that, than i think this feature is ready

@HanneloreVerbraekel
Copy link
Contributor Author

Should be fixed now?

Copy link
Collaborator

@mkszepp mkszepp 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! LGTM

@@ -93,20 +94,20 @@
@cell-size: null,
@cell-width: @cell-size,
@cell-height: @cell-size,
@cell-with-spacing-width: @cell-width + 2px,
@cell-with-spacing-width: calc(~"@{cell-width} + 2px");
Copy link
Collaborator

Choose a reason for hiding this comment

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

";" is not correct, should be like before ","

@row-padding-top: 0,
@row-padding-bottom: 0,
@row-padding-left: 0,
@row-padding-right: 0,
@row-width: @cell-with-spacing-width * 7 - 2px + @row-padding-left + @row-padding-right,
@row-height: @cell-height + 2px,
@row-width: calc(~"(@{cell-with-spacing-width} * 7) - 2px + @{row-padding-left} + @{row-padding-right}");
Copy link
Collaborator

Choose a reason for hiding this comment

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

";" is not correct, should be like before ","

@row-width: @cell-with-spacing-width * 7 - 2px + @row-padding-left + @row-padding-right,
@row-height: @cell-height + 2px,
@row-width: calc(~"(@{cell-with-spacing-width} * 7) - 2px + @{row-padding-left} + @{row-padding-right}");
@row-height: calc(~"@{cell-height} + 2px");
Copy link
Collaborator

Choose a reason for hiding this comment

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

";" is not correct, should be like before ","

@mkszepp mkszepp merged commit bdd2fa4 into cibernox:master May 30, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants