question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage of css custom properties on top of sass variables

See original GitHub issue

Clear and concise description of the problem

Some of us don’t want to use scss/sass, but still want to be able to customize the looks of the calendar. We might use other toolchains that make it hard to incorporate scss, such as tailwind css. It might also be desirable to change the style during runtime, if there is a dark theme for the website for example.

Suggested solution

I suggest you add custom properties to the rbc-calendar css class for all the scss variables, and make use of those everywhere instead of the scss variables. That means it would look something like this:

.rbc-calendar {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  
  --rbc-out-of-range-color: #{$out-of-range-color};
  --rbc-out-of-range-bg-color: #{$out-of-range-bg-color};
  ...
}

And then, you’d use it like this:

.rbc-off-range {
    color: var(--rbc-out-of-range-color);
}

This way, you don’t lose any backwards compatability for those using scss in their builds, while allowing people to use rbc without scss as well as changing themes easily in runtime.

Alternative

No response

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn’t already an issue that request the same feature to avoid creating a duplicate.

Would you like to open a PR for this feature?

  • I’m willing to open a PR

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
PooShamcommented, Oct 6, 2022

@cutterbl Have you thought more about it?

1reaction
cutterblcommented, Jul 8, 2022

@PooSham I think this is a great idea. Happy to test and a approve a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Custom Properties (vars) with SASS/SCSS, a practical ...
A practical strategy to deal with css custom properties on large sass/scss codebases. Tagged with css, frontend, showdev, webdev.
Read more >
Property Declarations - Sass
In Sass as in CSS, property declarations define how elements that match a selector ... CSS custom properties, also known as CSS variables,...
Read more >
Why we prefer CSS Custom Properties to SASS variables
Native, custom properties allow you to define variables without the need for CSS extensions (i.e., SASS). Are they the same? Not really!
Read more >
A Complete Guide to Custom Properties | CSS-Tricks
Say you're already using Sass, Less, or Stylus. All those CSS preprocessors offer variables and it's one of the main reasons to have...
Read more >
Using CSS custom properties (variables) - MDN Web Docs
Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found