Skip to content

chore: Enable return of dependency CSS as Sass files#4044

Merged
gadenbuie merged 6 commits intomainfrom
chore/dependecy-as-sass
Jun 13, 2024
Merged

chore: Enable return of dependency CSS as Sass files#4044
gadenbuie merged 6 commits intomainfrom
chore/dependecy-as-sass

Conversation

@gadenbuie
Copy link
Member

This PR makes it possible to extract the Sass files prior to compilation for the following CSS:

  • shiny - shinyDependencySassLayer()
  • selectize - selectizeSassLayer()
  • ionrangeslider - ionRangeSliderDependencySassLayer()
  • daterange picker - datePickerSassLayer()

The naming might look inconsistent, but there's a method: I added a new function adjacent to the ____CSS() function for each component, replacing CSS with SassLayer.

This is an internal-facing refactor to support dynamic theming in Shiny for Python, where we need access to the pre-compiled Sass files for each dependency.

Pairs with:

gadenbuie added 2 commits May 6, 2024 08:41
Makes it possible to extract the Sass files prior to compilation for the following CSS:

* shiny
* selectize
* ionrangeslider
* daterange picker
R/input-date.R Outdated
Comment on lines +156 to +160
datePickerSassLayer <- function() {
sass::sass_file(
system_file(package = "shiny", "www/shared/datepicker/scss/build3.scss")
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I'd prefer Layer to not be in the name since I'd expect it to return a sass::sass_layer().

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure. I used that because 1. It's not clear to me what exactly a sass layer is and 2. in bslib we already had component_dependency_sass() which compiles Sass but actually returns an HTMLDependency.

@gadenbuie gadenbuie requested a review from cpsievert June 12, 2024 17:59
@gadenbuie gadenbuie merged commit 0b7fda7 into main Jun 13, 2024
@gadenbuie gadenbuie deleted the chore/dependecy-as-sass branch June 13, 2024 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants