Skip to content

Commit

Permalink
Make sure bslib-scss/functions.scss is always included (in Bootstrap …
Browse files Browse the repository at this point in the history
…layer); make jquerylib file path relative
  • Loading branch information
cpsievert committed Nov 21, 2023
1 parent c4f1c29 commit ec9b495
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
20 changes: 13 additions & 7 deletions R/bs-theme.R
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ bootstrap_bundle <- function(version) {

full_bundle <- sass_bundle(
main_bundle,
bslib = bslib_bundle(version)
bslib_bundle(version)
)

new_bs_theme(full_bundle, version)
Expand Down Expand Up @@ -397,13 +397,19 @@ bootstrap_javascript <- function(version) {
# N.B. If you find yourself changing this function, be careful about what
# the implications might be for Quarto!
bslib_bundle <- function(version) {
sass_layer(
functions = sass_file(path_inst("bslib-scss", "functions.scss")),
defaults = list(
"bootstrap-version" = version,
sass_file(path_inst("bslib-scss", "defaults.scss"))
sass_bundle(
# Required functions (that we assume are defined prior to Bootstrap)
sass_layer(
functions = sass_file(path_inst("bslib-scss", "functions.scss"))
),
rules = sass_file(path_inst("bslib-scss", "rules.scss"))
# Optional layer of new defaults and rules
bslib = sass_layer(
defaults = list(
"bootstrap-version" = version,
sass_file(path_inst("bslib-scss", "defaults.scss"))
),
rules = sass_file(path_inst("bslib-scss", "rules.scss"))
)
)
}

Expand Down
2 changes: 0 additions & 2 deletions inst/bslib-scss/defaults.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@ $bootstrap-version: null !default; // Should always be brought in via R
$bslib-preset-name: null !default;
$bslib-preset-type: null !default;



// Bootstrap Sass defaults that we take advantage of
$enable-cssgrid: true !default;
5 changes: 2 additions & 3 deletions inst/css-precompiled/5/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "jquery",
"version": "3.6.0",
"src": {
"file": "/home/runner/work/_temp/Library/jquerylib/lib/3.6.0"
"file": "lib/3.6.0"
},
"script": "jquery-3.6.0.min.js",
"all_files": true
Expand All @@ -22,13 +22,12 @@
"all_files": true,
"sass_layers": {
"bootstrap": {
"functions": "@import \"lib/bs5/scss/_functions.scss\";",
"functions": ["@import \"lib/bs5/scss/_functions.scss\";", "@import \"bslib-scss/functions.scss\";"],
"defaults": ["", "", "", "@import \"lib/bs5/scss/_variables.scss\";", "@import \"lib/bs5/scss/_variables-dark.scss\";"],
"mixins": ["@import \"lib/bs5/scss/_maps.scss\";", "@import \"lib/bs5/scss/_mixins.scss\";"],
"rules": ["@import \"lib/bs5/scss/mixins/_banner.scss\";", "@include bsBanner('')", "@import \"lib/bs5/scss/_utilities.scss\";", "@import \"lib/bs5/scss/_root.scss\";", "@import \"lib/bs5/scss/_reboot.scss\";", "@import \"lib/bs5/scss/_type.scss\";", "@import \"lib/bs5/scss/_images.scss\";", "@import \"lib/bs5/scss/_containers.scss\";", "@import \"lib/bs5/scss/_grid.scss\";", "@import \"lib/bs5/scss/_tables.scss\";", "@import \"lib/bs5/scss/_forms.scss\";", "@import \"lib/bs5/scss/_buttons.scss\";", "@import \"lib/bs5/scss/_transitions.scss\";", "@import \"lib/bs5/scss/_dropdown.scss\";", "@import \"lib/bs5/scss/_button-group.scss\";", "@import \"lib/bs5/scss/_nav.scss\";", "@import \"lib/bs5/scss/_navbar.scss\";", "@import \"lib/bs5/scss/_card.scss\";", "@import \"lib/bs5/scss/_accordion.scss\";", "@import \"lib/bs5/scss/_breadcrumb.scss\";", "@import \"lib/bs5/scss/_pagination.scss\";", "@import \"lib/bs5/scss/_badge.scss\";", "@import \"lib/bs5/scss/_alert.scss\";", "@import \"lib/bs5/scss/_progress.scss\";", "@import \"lib/bs5/scss/_list-group.scss\";", "@import \"lib/bs5/scss/_close.scss\";", "@import \"lib/bs5/scss/_toasts.scss\";", "@import \"lib/bs5/scss/_modal.scss\";", "@import \"lib/bs5/scss/_tooltip.scss\";", "@import \"lib/bs5/scss/_popover.scss\";", "@import \"lib/bs5/scss/_carousel.scss\";", "@import \"lib/bs5/scss/_spinners.scss\";", "@import \"lib/bs5/scss/_offcanvas.scss\";", "@import \"lib/bs5/scss/_placeholders.scss\";", "@import \"lib/bs5/scss/_helpers.scss\";", "@import \"lib/bs5/scss/utilities/_api.scss\";"]
},
"bslib": {
"functions": "@import \"bslib-scss/functions.scss\";",
"defaults": ["$bootstrap-version: 5;", "@import \"bslib-scss/defaults.scss\";"],
"rules": "@import \"bslib-scss/rules.scss\";"
},
Expand Down
8 changes: 8 additions & 0 deletions tools/yarn_install.R
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ invisible(lapply(versions(), function(version) {
deps <- lapply(deps, function(d) {
d <- dropNulls(d)
d$src$file <- gsub(file.path(getwd(), "inst/"), "", d$src$file)
if (d$name == "jquery") {
d$src$file <- sub(
paste0(system.file(package = "jquerylib"), "/"),
"",
d$src$file
)
}
if (d$name == "bootstrap") {
d$sass_layers <- simplified_theme_layers(theme)
# "Fake" this dir since it's a tempdir()
Expand All @@ -525,6 +532,7 @@ invisible(lapply(versions(), function(version) {
))
# "Fake" this dir since it's a tempdir()
d$src$file <- "inst/components/dist"
d$stylesheet <- "components.css"
}
d
})
Expand Down

0 comments on commit ec9b495

Please sign in to comment.