28 |
29 | Place your devtools::session_info() here
30 |
31 |
32 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name : Feature request
3 | about : Request a new feature.
4 | ---
5 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name : Ask a Question
3 | about : The issue tracker is not for general help questions -- please ask general plumber help questions on RStudio Community, https://forum.posit.co/tag/sass.
4 | ---
5 |
6 | The issue tracker is not for questions. If you have a question, please feel free to ask sass help questions on RStudio Community under the `sass` tag, at https://forum.posit.co/tag/sass. Please tag your post with a `sass` tag to increase visibility.
7 |
8 | [Click here](https://forum.posit.co/new-topic?title=&tags=sass&u=cpsievert&body=%0A%0A%0A--------%0A%0A%3Csup%3EReferred%20here%20by%20%5B%60rstudio%2Fsass%60%5D(http%3A%2F%2Fgithub.com%2Frstudio%2Fsass)%3C%2Fsup%3E%0A) to create a new post with a `sass` tag.
9 |
10 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Pull Request
2 |
3 | Before you submit a pull request, please ensure you've completed the following checklist
4 |
5 | - [ ] Ensure there is an already open and relevant [GitHub issue](https://github.com/rstudio/sass/issues/new) describing the problem in detail and you've already received some indication from the maintainers that they are welcome to a contribution to fix the problem. This helps us to prevent wasting anyone's time.
6 |
7 | - [ ] Add unit tests in the tests/testthat directory.
8 |
9 | - [ ] This project uses [roxygen2 for documentation](http://r-pkgs.had.co.nz/man.html). If you've made changes to documentation, run `devtools::document()`.
10 |
11 | - [ ] Run `devtools::check()` (or, equivalently, click on Build->Check Package in the RStudio IDE) to make sure your change did not add any messages, warnings, or errors.
12 | * Note there is a decent chance that some tests were already failing before your changes. Just make sure you haven't introduced any new ones.
13 |
14 | - [ ] Ensure your code changes follow the style outlined in http://r-pkgs.had.co.nz/style.html
15 |
16 | - [ ] Add an entry to NEWS.md concisely describing what you changed.
17 |
--------------------------------------------------------------------------------
/.github/workflows/R-CMD-check.yaml:
--------------------------------------------------------------------------------
1 | # Workflow derived from https://github.com/rstudio/shiny-workflows
2 | #
3 | # NOTE: This Shiny team GHA workflow is overkill for most R packages.
4 | # For most R packages it is better to use https://github.com/r-lib/actions
5 | on:
6 | push:
7 | branches: [main, rc-**]
8 | pull_request:
9 | branches: [main]
10 | schedule:
11 | - cron: '0 4 * * 1' # every monday
12 |
13 | name: Package checks
14 |
15 | jobs:
16 | website:
17 | uses: rstudio/shiny-workflows/.github/workflows/website.yaml@v1
18 | routine:
19 | uses: rstudio/shiny-workflows/.github/workflows/routine.yaml@v1
20 | R-CMD-check:
21 | uses: rstudio/shiny-workflows/.github/workflows/R-CMD-check.yaml@v1
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | inst/doc
2 | .Rproj.user
3 | .Rhistory
4 | .RData
5 | .Ruserdata
6 | .DS_Store
7 | README.html
8 | Untitled.*
9 | doc
10 | Meta
11 | revdep
12 | docs
13 | scripts/build
14 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Type: Package
2 | Package: sass
3 | Version: 0.4.10.9000
4 | Title: Syntactically Awesome Style Sheets ('Sass')
5 | Description: An 'SCSS' compiler, powered by the 'LibSass' library. With this,
6 | R developers can use variables, inheritance, and functions to generate
7 | dynamic style sheets. The package uses the 'Sass CSS' extension language,
8 | which is stable, powerful, and CSS compatible.
9 | Authors@R: c(
10 | person("Joe", "Cheng", , "joe@rstudio.com", "aut"),
11 | person("Timothy", "Mastny", , "tim.mastny@gmail.com", "aut"),
12 | person("Richard", "Iannone", , "rich@rstudio.com", "aut",
13 | comment = c(ORCID = "0000-0003-3925-190X")),
14 | person("Barret", "Schloerke", , "barret@rstudio.com", "aut",
15 | comment = c(ORCID = "0000-0001-9986-114X")),
16 | person("Carson", "Sievert", , "carson@rstudio.com", c("aut", "cre"),
17 | comment = c(ORCID = "0000-0002-4958-2844")),
18 | person("Christophe", "Dervieux", , "cderv@rstudio.com", c("ctb"),
19 | comment = c(ORCID = "0000-0003-4474-2498")),
20 | person(family = "RStudio", role = c("cph", "fnd")),
21 | person(family = "Sass Open Source Foundation", role = c("ctb", "cph"),
22 | comment = "LibSass library"),
23 | person("Greter", "Marcel", role = c("ctb", "cph"),
24 | comment = "LibSass library"),
25 | person("Mifsud", "Michael", role = c("ctb", "cph"),
26 | comment = "LibSass library"),
27 | person("Hampton", "Catlin", role = c("ctb", "cph"),
28 | comment = "LibSass library"),
29 | person("Natalie", "Weizenbaum", role = c("ctb", "cph"),
30 | comment = "LibSass library"),
31 | person("Chris", "Eppstein", role = c("ctb", "cph"),
32 | comment = "LibSass library"),
33 | person("Adams", "Joseph", role = c("ctb", "cph"),
34 | comment = "json.cpp"),
35 | person("Trifunovic", "Nemanja", role = c("ctb", "cph"),
36 | comment = "utf8.h")
37 | )
38 | License: MIT + file LICENSE
39 | URL: https://rstudio.github.io/sass/, https://github.com/rstudio/sass
40 | BugReports: https://github.com/rstudio/sass/issues
41 | Encoding: UTF-8
42 | RoxygenNote: 7.3.2
43 | Roxygen: list(markdown = TRUE)
44 | SystemRequirements: GNU make
45 | Imports:
46 | fs (>= 1.2.4),
47 | rlang (>= 0.4.10),
48 | htmltools (>= 0.5.1),
49 | R6,
50 | rappdirs
51 | Suggests:
52 | testthat,
53 | knitr,
54 | rmarkdown,
55 | withr,
56 | shiny,
57 | curl
58 | VignetteBuilder: knitr
59 | Config/testthat/edition: 3
60 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2019
2 | COPYRIGHT HOLDER: RStudio, Inc.
3 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright (c) 2019 RStudio, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(format,css)
4 | S3method(format,sass)
5 | S3method(format,sass_bundle)
6 | S3method(format,sass_layer)
7 | S3method(print,css)
8 | S3method(print,sass)
9 | S3method(print,sass_bundle)
10 | S3method(print,sass_layer)
11 | export(as_sass)
12 | export(as_sass_layer)
13 | export(font_collection)
14 | export(font_face)
15 | export(font_google)
16 | export(font_link)
17 | export(is_font_collection)
18 | export(is_sass_bundle)
19 | export(output_template)
20 | export(sass)
21 | export(sass_bundle)
22 | export(sass_bundle_remove)
23 | export(sass_cache_context_dir)
24 | export(sass_cache_get)
25 | export(sass_cache_get_dir)
26 | export(sass_cache_options)
27 | export(sass_cache_set_dir)
28 | export(sass_file)
29 | export(sass_file_cache)
30 | export(sass_import)
31 | export(sass_layer)
32 | export(sass_layer_file)
33 | export(sass_layer_merge)
34 | export(sass_options)
35 | export(sass_options_get)
36 | export(sass_options_set)
37 | export(sass_partial)
38 | export(write_file_attachments)
39 | import(htmltools)
40 | importFrom(R6,R6Class)
41 | importFrom(rlang,"%||%")
42 | importFrom(rlang,have_name)
43 | importFrom(rlang,is_missing)
44 | importFrom(rlang,list2)
45 | importFrom(rlang,maybe_missing)
46 | importFrom(rlang,missing_arg)
47 | importFrom(rlang,names2)
48 | importFrom(stats,na.omit)
49 | importFrom(utils,download.file)
50 | importFrom(utils,modifyList)
51 | importFrom(utils,packageVersion)
52 | useDynLib(sass, .registration = TRUE)
53 |
--------------------------------------------------------------------------------
/R/as_html.R:
--------------------------------------------------------------------------------
1 |
2 |
3 | # add class html and attr('html') <- TRUE to spoof htmltoolts::HTML(css) output
4 | as_html <- function(x, extra_class = NULL) {
5 | class(x) <- c(extra_class, "html", "character")
6 | attr(x, "html") <- TRUE
7 | x
8 | }
9 |
--------------------------------------------------------------------------------
/R/compile.R:
--------------------------------------------------------------------------------
1 |
2 | #' @useDynLib sass, .registration = TRUE
3 | compile_file <- function(file, opts) {
4 | .Call(C_compile_file, file, opts)
5 | }
6 |
7 | compile_data <- function(data, opts) {
8 | .Call(C_compile_data, data, opts)
9 | }
10 |
11 | .onUnload <- function (libpath) {
12 | library.dynam.unload("sass", libpath)
13 | }
14 |
--------------------------------------------------------------------------------
/R/deprecated.R:
--------------------------------------------------------------------------------
1 |
2 | #' Deprecated
3 | #'
4 | #' Deprecated Sass functions
5 | #'
6 | #' @rdname sass-deprecated
7 | #' @name sass-deprecated
8 | #' @keywords internal
9 | NULL
10 |
11 | #' @describeIn sass-deprecated Please use `sass_bundle(...)`
12 | #' @export
13 | sass_layer_merge <- function(...) {
14 | .Deprecated(msg = "`sass_layer_merge()` is deprecated. Please use `sass_bundle()` instead. See `?sass_bundle()`")
15 | sass_bundle(...)
16 | }
17 |
--------------------------------------------------------------------------------
/R/shiny_devmode.R:
--------------------------------------------------------------------------------
1 |
2 |
3 | ###
4 | # These methods could be removed if shiny were able to be imported.
5 | # * `shiny::in_devmode()`
6 | # * `shiny::get_devmode_option()`
7 | ###
8 |
9 |
10 | in_shiny_devmode <- function() {
11 | isTRUE(getOption("shiny.devmode", FALSE)) &&
12 | !identical(Sys.getenv("TESTTHAT"), "true")
13 | }
14 |
15 | #' @importFrom rlang missing_arg is_missing maybe_missing
16 | get_shiny_devmode_option <- function(
17 | name,
18 | default = NULL,
19 | devmode_default = missing_arg(),
20 | devmode_message = missing_arg()
21 | ) {
22 |
23 | if (!in_shiny_devmode()) {
24 | # Dev Mode disabled, act like `getOption()`
25 | return(getOption(name, default = default))
26 | }
27 |
28 | # Dev Mode enabled, update the default value for `getOption()`
29 | getOption(name, default = {
30 | # Notify developer
31 | if (
32 | !is_missing(devmode_message) &&
33 | !is.null(devmode_message) &&
34 | getOption("shiny.devmode.verbose", TRUE)
35 | ) {
36 | devmode_message <- paste0("shiny devmode - ", devmode_message)
37 | rlang::inform(
38 | message = devmode_message,
39 | .frequency = "regularly",
40 | .frequency_id = devmode_message,
41 | .file = stderr()
42 | )
43 | }
44 |
45 | # Return Dev Mode default value `devmode_default`
46 | maybe_missing(devmode_default, default)
47 | })
48 | }
49 |
--------------------------------------------------------------------------------
/R/staticimports.R:
--------------------------------------------------------------------------------
1 | # Generated by staticimports; do not edit by hand.
2 | # ======================================================================
3 | # Imported from pkg:staticimports
4 | # ======================================================================
5 |
6 | get_package_version <- function(pkg) {
7 | # `utils::packageVersion()` can be slow, so first try the fast path of
8 | # checking if the package is already loaded.
9 | ns <- .getNamespace(pkg)
10 | if (is.null(ns)) {
11 | utils::packageVersion(pkg)
12 | } else {
13 | as.package_version(ns$.__NAMESPACE__.$spec[["version"]])
14 | }
15 | }
16 |
17 | is_installed <- function(pkg, version = NULL) {
18 | installed <- isNamespaceLoaded(pkg) || nzchar(system_file_cached(package = pkg))
19 | if (is.null(version)) {
20 | return(installed)
21 | }
22 | installed && isTRUE(get_package_version(pkg) >= version)
23 | }
24 |
25 | # A wrapper for `system.file()`, which caches the results, because
26 | # `system.file()` can be slow. Note that because of caching, if
27 | # `system_file_cached()` is called on a package that isn't installed, then the
28 | # package is installed, and then `system_file_cached()` is called again, it will
29 | # still return "".
30 | system_file_cached <- local({
31 | pkg_dir_cache <- character()
32 |
33 | function(..., package = "base") {
34 | if (!is.null(names(list(...)))) {
35 | stop("All arguments other than `package` must be unnamed.")
36 | }
37 |
38 | not_cached <- is.na(match(package, names(pkg_dir_cache)))
39 | if (not_cached) {
40 | pkg_dir <- system.file(package = package)
41 | pkg_dir_cache[[package]] <<- pkg_dir
42 | } else {
43 | pkg_dir <- pkg_dir_cache[[package]]
44 | }
45 |
46 | file.path(pkg_dir, ...)
47 | }
48 | })
49 |
--------------------------------------------------------------------------------
/inst/examples/example-full.scss:
--------------------------------------------------------------------------------
1 | $bg: #333;
2 | $fg: white;
3 | $fontsize: 16px;
4 |
5 | body {
6 | background-color: $bg;
7 | color: $fg;
8 | font-size: $fontsize;
9 | }
10 |
--------------------------------------------------------------------------------
/inst/examples/rules.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: $bg;
3 | color: $fg;
4 | font-size: $fontsize;
5 | }
6 |
--------------------------------------------------------------------------------
/inst/examples/variables.scss:
--------------------------------------------------------------------------------
1 | $bg: #333;
2 | $fg: white;
3 | $fontsize: 16px;
4 |
--------------------------------------------------------------------------------
/inst/sass-color/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Title: Sass Color Example
2 | Author: RStudio, Inc.
3 | AuthorUrl: http://www.rstudio.com/
4 | License: MIT
5 | DisplayMode: Showcase
6 | Tags: sass css
7 | Type: Shiny
8 |
--------------------------------------------------------------------------------
/inst/sass-color/README.md:
--------------------------------------------------------------------------------
1 | This example shows how to use the [sass](https://github.com/rstudio/sass) R package to dynamically generate a stylesheet that changes the background color in a shiny app.
2 |
--------------------------------------------------------------------------------
/inst/sass-color/app.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(sass)
3 | library(colourpicker)
4 |
5 | ui <- fluidPage(
6 | headerPanel("Sass Color Example"),
7 | uiOutput("sass"),
8 |
9 | sidebarPanel(
10 | colourInput("color", "Background Color", value = "#6498d2",
11 | showColour = "text")
12 | ),
13 |
14 | mainPanel(
15 | plotOutput("distPlot"),
16 | br()
17 | ),
18 |
19 | column(6, verbatimTextOutput("scssTxt")),
20 | column(6, verbatimTextOutput("cssTxt"))
21 | )
22 |
23 | server <- function(input, output) {
24 | output$distPlot <- renderPlot({
25 | hist(rnorm(500))
26 | })
27 |
28 | variables <- reactive({
29 | list(
30 | color = input$color
31 | )
32 | })
33 |
34 | sass_input <- reactive({
35 | list(
36 | variables(),
37 | paste(
38 | "body {",
39 | " background-color: $color;",
40 | "}",
41 | sep = "\n"
42 | )
43 | )
44 | })
45 | compiled_css <- reactive({
46 | sass(sass_input())
47 | })
48 |
49 | output$sass <- renderUI({
50 | tags$head(tags$style(compiled_css()))
51 | })
52 |
53 | output$scssTxt <- renderText({
54 | paste0("/* Sass */\n", as_sass(sass_input()))
55 | })
56 |
57 | output$cssTxt <- renderText({
58 | paste0("/* Compiled CSS */\n", compiled_css())
59 | })
60 | }
61 |
62 | shinyApp(ui, server)
63 |
--------------------------------------------------------------------------------
/inst/sass-color/rsconnect/shinyapps.io/gallery/sass-color.dcf:
--------------------------------------------------------------------------------
1 | name: sass-color
2 | title: sass-color
3 | username:
4 | account: gallery
5 | server: shinyapps.io
6 | hostUrl: https://api.shinyapps.io/v1
7 | appId: 429290
8 | bundleId: 1584201
9 | url: https://gallery.shinyapps.io/sass-color/
10 | when: 1536858925.49865
11 | asMultiple: FALSE
12 | asStatic: FALSE
13 |
--------------------------------------------------------------------------------
/inst/sass-font/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Title: Sass Font Example
2 | Author: RStudio, Inc.
3 | AuthorUrl: http://www.rstudio.com/
4 | License: MIT
5 | DisplayMode: Showcase
6 | Tags: sass css
7 | Type: Shiny
8 |
--------------------------------------------------------------------------------
/inst/sass-font/README.md:
--------------------------------------------------------------------------------
1 | This example shows how to use the [sass](https://github.com/rstudio/sass) R package to dynamically generate a stylesheet that changes the background color in a shiny app. The font color also depends on the background color, changing between black and white as necessary.
2 |
--------------------------------------------------------------------------------
/inst/sass-font/app.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(sass)
3 | library(colourpicker)
4 |
5 | ui <- fluidPage(
6 | headerPanel("Sass Font Example"),
7 | uiOutput("sass"),
8 |
9 | sidebarPanel(
10 | colourInput("color", "Background Color", value = "#6498d2",
11 | showColour = "text")
12 | ),
13 |
14 | mainPanel(
15 | plotOutput("distPlot"),
16 | br()
17 | ),
18 |
19 | column(6, verbatimTextOutput("scssTxt"), verbatimTextOutput("sassFile")),
20 | column(6, verbatimTextOutput("cssTxt"))
21 | )
22 |
23 | server <- function(input, output) {
24 | output$distPlot <- renderPlot({
25 | hist(rnorm(500))
26 | })
27 |
28 | variables <- reactive({
29 | list(
30 | color = input$color
31 | )
32 | })
33 |
34 | sass_input <- reactive({
35 | list(
36 | variables(),
37 | sass_file("sass-font.scss")
38 | )
39 | })
40 | compiled_css <- reactive({
41 | sass(sass_input())
42 | })
43 |
44 | output$sass <- renderUI({
45 | tags$head(tags$style(compiled_css()))
46 | })
47 |
48 | output$scssTxt <- renderText({
49 | paste0("/* Sass */\n", as_sass(sass_input()))
50 | })
51 | output$sassFile <- renderText({
52 | paste0(
53 | "/* sass-font.scss */\n\n",
54 | paste0(readLines("sass-font.scss"), collapse = "\n")
55 | )
56 | })
57 |
58 | output$cssTxt <- renderText({
59 | paste0("/* Compiled CSS */\n", compiled_css())
60 | })
61 | }
62 |
63 | shinyApp(ui, server)
64 |
--------------------------------------------------------------------------------
/inst/sass-font/rsconnect/shinyapps.io/gallery/sass-font.dcf:
--------------------------------------------------------------------------------
1 | name: sass-font
2 | title: sass-font
3 | username:
4 | account: gallery
5 | server: shinyapps.io
6 | hostUrl: https://api.shinyapps.io/v1
7 | appId: 429503
8 | bundleId: 1585777
9 | url: https://gallery.shinyapps.io/sass-font/
10 | when: 1536936506.34148
11 | asMultiple: FALSE
12 | asStatic: FALSE
13 |
--------------------------------------------------------------------------------
/inst/sass-font/sass-font.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: $color;
3 | }
4 |
5 | // https://stackoverflow.com/a/3943023/6637133
6 | @function font-color($color) {
7 | @return if(
8 | red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114 > 186,
9 | #000000, #ffffff
10 | );
11 | }
12 |
13 | h1 {
14 | color: if(
15 | red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114 > 186,
16 | #000000, #ffffff);
17 | }
18 |
--------------------------------------------------------------------------------
/inst/sass-size/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Title: Sass Resize Example
2 | Author: RStudio, Inc.
3 | AuthorUrl: http://www.rstudio.com/
4 | License: MIT
5 | DisplayMode: Showcase
6 | Tags: sass css
7 | Type: Shiny
8 |
--------------------------------------------------------------------------------
/inst/sass-size/README.md:
--------------------------------------------------------------------------------
1 | This example shows how to use the [sass](https://github.com/rstudio/sass) R package to dynamically generate a stylesheet that changes the background and font color in a shiny app. The app also allows you to dynmically resize the plot width.
2 |
--------------------------------------------------------------------------------
/inst/sass-size/app.R:
--------------------------------------------------------------------------------
1 | library(shiny)
2 | library(sass)
3 | library(colourpicker)
4 |
5 | ui <- fluidPage(
6 | headerPanel("Sass Size Example"),
7 | uiOutput("sass"),
8 |
9 | sidebarPanel(
10 | sliderInput("width", "Image Percent of Screen",
11 | min = 1, max = 100, value = 100),
12 | colourInput("color", "Background Color", value = "#6498d2",
13 | showColour = "text")
14 | ),
15 |
16 | mainPanel(
17 | plotOutput("distPlot"),
18 | br()
19 | ),
20 |
21 | column(6, verbatimTextOutput("scssTxt"), verbatimTextOutput("sassFile")),
22 | column(6, verbatimTextOutput("cssTxt"))
23 | )
24 |
25 | server <- function(input, output) {
26 | output$distPlot <- renderPlot({
27 | hist(rnorm(500))
28 | })
29 |
30 | variables <- reactive({
31 | list(
32 | color = input$color,
33 | width = input$width
34 | )
35 | })
36 |
37 | sass_input <- reactive({
38 | list(
39 | variables(),
40 | sass_file("sass-size.scss")
41 | )
42 | })
43 | compiled_css <- reactive({
44 | sass(sass_input())
45 | })
46 |
47 | output$sass <- renderUI({
48 | tags$head(tags$style(compiled_css()))
49 | })
50 |
51 | output$scssTxt <- renderText({
52 | paste0("/* Sass */\n", as_sass(sass_input()))
53 | })
54 | output$sassFile <- renderText({
55 | paste0(
56 | "/* sass-size.scss */\n\n",
57 | paste0(readLines("sass-size.scss"), collapse = "\n")
58 | )
59 | })
60 |
61 | output$cssTxt <- renderText({
62 | paste0("/* Compiled CSS */\n", compiled_css())
63 | })
64 | }
65 |
66 | shinyApp(ui, server)
67 |
--------------------------------------------------------------------------------
/inst/sass-size/rsconnect/shinyapps.io/gallery/sass-size.dcf:
--------------------------------------------------------------------------------
1 | name: sass-size
2 | title: sass-size
3 | username:
4 | account: gallery
5 | server: shinyapps.io
6 | hostUrl: https://api.shinyapps.io/v1
7 | appId: 429512
8 | bundleId: 1585784
9 | url: https://gallery.shinyapps.io/sass-size/
10 | when: 1536936702.32887
11 | asMultiple: FALSE
12 | asStatic: FALSE
13 |
--------------------------------------------------------------------------------
/inst/sass-size/sass-size.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: $color;
3 | }
4 |
5 | // https://stackoverflow.com/a/3943023/6637133
6 | @function font-color($color) {
7 | @return if(
8 | red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114 > 186,
9 | #000000, #ffffff
10 | );
11 | }
12 |
13 | h1 {
14 | color: if(
15 | red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114 > 186,
16 | #000000, #ffffff);
17 | }
18 |
19 | .shiny-plot-output {
20 | max-width: percentage($width / 100);
21 | }
22 |
--------------------------------------------------------------------------------
/inst/sass-theme/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Title: Sass CSS Theme
2 | Author: RStudio, Inc.
3 | AuthorUrl: http://www.rstudio.com/
4 | License: MIT
5 | DisplayMode: Showcase
6 | Tags: sass css javascript
7 | Type: Shiny
8 |
--------------------------------------------------------------------------------
/inst/sass-theme/README.md:
--------------------------------------------------------------------------------
1 | This self contained example shows how to use the [sass](https://github.com/rstudio/sass) R package to generate CSS for multiple themes and dynamically create colors based off of an original theme color. If a Shiny button is clicked, the javascript event is captured and the theme color is updated within the browser. A Shiny server event is triggered in addition to changing the theme within browser.
2 |
3 | Original [article](http://www.sitepoint.com/dealing-color-schemes-sass/) and [demo](https://codepen.io/SitePoint/pen/czixa) by [Hugo Giraudel](https://codepen.io/HugoGiraudel).
4 |
--------------------------------------------------------------------------------
/inst/sass-theme/rsconnect/shinyapps.io/gallery/sass-theme.dcf:
--------------------------------------------------------------------------------
1 | name: sass-theme
2 | title: sass-theme
3 | username:
4 | account: gallery
5 | server: shinyapps.io
6 | hostUrl: https://api.shinyapps.io/v1
7 | appId: 429513
8 | bundleId: 1584213
9 | url: https://gallery.shinyapps.io/sass-theme/
10 | when: 1536859335.89206
11 | asMultiple: FALSE
12 | asStatic: FALSE
13 |
--------------------------------------------------------------------------------
/logo/sass-hex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/logo/sass-hex.png
--------------------------------------------------------------------------------
/logo/sass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/logo/sass.png
--------------------------------------------------------------------------------
/man/as_sass.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/as_sass.R
3 | \name{as_sass}
4 | \alias{as_sass}
5 | \title{Convert an R object into Sass code}
6 | \usage{
7 | as_sass(input)
8 | }
9 | \arguments{
10 | \item{input}{Any of the following:
11 | \itemize{
12 | \item A character vector containing Sass code.
13 | \item A named list containing variable names and values.
14 | \item A \code{\link[=sass_file]{sass_file()}}, \code{\link[=sass_layer]{sass_layer()}}, and/or \code{\link[=sass_bundle]{sass_bundle()}}.
15 | \item A \code{\link[=list]{list()}} containing any of the above.
16 | }}
17 | }
18 | \value{
19 | a single character value to be supplied to \code{\link[=sass]{sass()}}.
20 | }
21 | \description{
22 | Converts multiple types of inputs to a single Sass input string for
23 | \code{\link[=sass]{sass()}}.
24 | }
25 | \examples{
26 | # Example of regular Sass input
27 | as_sass("body { color: \"blue\"; }")
28 |
29 | # There is support for adding variables
30 | as_sass(
31 | list(
32 | list(color = "blue"),
33 | "body { color: $color; }"
34 | )
35 | )
36 |
37 | \donttest{
38 | # Add a file name
39 | someFile <- tempfile("variables")
40 |
41 | # Overwrite color to red
42 | write("$color: \"red\";", someFile)
43 |
44 | input <-
45 | as_sass(
46 | list(
47 | list(color = "blue"),
48 | sass_file(someFile),
49 | "body { color: $color; }"
50 | )
51 | )
52 |
53 | input
54 |
55 | # The final body color is red
56 | sass(input)
57 | }
58 | }
59 | \references{
60 | \url{https://sass-lang.com/documentation/at-rules/import}
61 | }
62 |
--------------------------------------------------------------------------------
/man/as_sass_layer.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/layers.R
3 | \name{as_sass_layer}
4 | \alias{as_sass_layer}
5 | \title{Sass Bundle to Single Sass Layer}
6 | \usage{
7 | as_sass_layer(x)
8 | }
9 | \description{
10 | Converts a \code{\link[=sass_bundle]{sass_bundle()}} to a single Sass layer object.
11 | }
12 | \details{
13 | This is exported for internal use between packages and should not be used.
14 | Instead, please use \code{\link[=sass_layer]{sass_layer()}} or \code{\link[=sass_bundle]{sass_bundle()}} to construct and manage your sass objects
15 | and \code{\link[=sass]{sass()}} and \code{\link[=as_sass]{as_sass()}} to convert your objects.
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/man/figures/sass-color.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/man/figures/sass-color.gif
--------------------------------------------------------------------------------
/man/figures/sass-logo-color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/man/figures/sass-logo-color.png
--------------------------------------------------------------------------------
/man/output_template.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sass.R
3 | \name{output_template}
4 | \alias{output_template}
5 | \title{An intelligent (temporary) output file}
6 | \usage{
7 | output_template(
8 | basename = "sass",
9 | dirname = basename,
10 | fileext = NULL,
11 | path = tempdir()
12 | )
13 | }
14 | \arguments{
15 | \item{basename}{a non-empty character string giving the outfile name (without
16 | the extension).}
17 |
18 | \item{dirname}{a non-empty character string giving the initial part of the
19 | directory name.}
20 |
21 | \item{fileext}{the output file extension. The default is \code{".min.css"} for
22 | compressed and compact output styles; otherwise, its \code{".css"}.}
23 |
24 | \item{path}{the output file's root directory path.}
25 | }
26 | \value{
27 | A function with two arguments: \code{options} and \code{suffix}. When called inside
28 | \code{\link[=sass]{sass()}} with caching enabled, the caching key is supplied to \code{suffix}.
29 | }
30 | \description{
31 | Intended for use with \code{\link[=sass]{sass()}}'s \code{output} argument for temporary file
32 | generation that is \code{cache} and \code{options} aware. In particular, this ensures
33 | that new redundant file(s) aren't generated on a \code{\link[=sass]{sass()}} cache hit, and that
34 | the file's extension is suitable for the \code{\link[=sass_options]{sass_options()}}'s \code{output_style}.
35 | }
36 | \examples{
37 | sass("body {color: red}", output = output_template())
38 |
39 | func <- output_template(basename = "foo", dirname = "bar-")
40 | func(suffix = "baz")
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/man/sass-deprecated.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/deprecated.R
3 | \name{sass-deprecated}
4 | \alias{sass-deprecated}
5 | \alias{sass_layer_merge}
6 | \title{Deprecated}
7 | \usage{
8 | sass_layer_merge(...)
9 | }
10 | \description{
11 | Deprecated Sass functions
12 | }
13 | \section{Functions}{
14 | \itemize{
15 | \item \code{sass_layer_merge()}: Please use \code{sass_bundle(...)}
16 |
17 | }}
18 | \keyword{internal}
19 |
--------------------------------------------------------------------------------
/man/sass_cache_context_dir.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sass_cache.R
3 | \name{sass_cache_context_dir}
4 | \alias{sass_cache_context_dir}
5 | \title{Return the cache directory for the current context.}
6 | \usage{
7 | sass_cache_context_dir()
8 | }
9 | \description{
10 | Return the cache directory for the current context.
11 | }
12 | \details{
13 | In most cases, this function returns the user's cache directory, by calling
14 | \code{tools::R_user_dir("sass", which = "cache")} (for R 4.0 and above) or
15 | \code{rappdirs::user_cache_dir("R-sass")} (for older versions of R).
16 |
17 | If this function is called from a Shiny application, it will also look for a
18 | subdirectory named \verb{app_cache/}. If it exists, it will use a directory named
19 | \verb{app_cache/sass/} to store the cache.
20 |
21 | When running a Shiny application in a typical R session, it will not create
22 | the \verb{app_cache/} subdirectory, but it will use it if present. This scopes the
23 | cache to the application.
24 |
25 | With Shiny applications hosted on Shiny Server and Connect, it \emph{will} create
26 | a \verb{app_cache/sass/} subdirectory, so that the cache is scoped to the
27 | application and will not interfere with another application's cache.
28 | }
29 | \keyword{internal}
30 |
--------------------------------------------------------------------------------
/man/sass_cache_get.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sass_cache.R
3 | \name{sass_cache_get}
4 | \alias{sass_cache_get}
5 | \title{Retrieve the default file cache}
6 | \usage{
7 | sass_cache_get()
8 | }
9 | \description{
10 | When caching is enabled, this function returns a \code{\link[=sass_file_cache]{sass_file_cache()}} object
11 | that \code{\link[=sass]{sass()}}'s \code{cache} argument uses (by default) for caching Sass
12 | compilation. When caching is disabled (either by setting the \code{sass.cache}
13 | option to \code{FALSE}, \code{NULL}, or via \code{\link[shiny:devmode]{shiny::devmode()}}), this function returns
14 | \code{NULL} (effectively telling \code{\link[=sass]{sass()}} to not \code{cache} by default).
15 | }
16 | \details{
17 | When caching is enabled, then this function returns a \code{sass_file_cache()}
18 | object that (by default) uses \code{\link[=sass_cache_context_dir]{sass_cache_context_dir()}} for its directory.
19 | The directory can also be customized by providing the \code{sass.cache} option
20 | with either a filepath (as a string) or a full-blown \code{sass_file_cache()}
21 | object.
22 | }
23 | \seealso{
24 | \code{\link[=sass_cache_get_dir]{sass_cache_get_dir()}}, \code{\link[=sass]{sass()}}
25 | }
26 |
--------------------------------------------------------------------------------
/man/sass_cache_get_dir.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sass_cache.R
3 | \name{sass_cache_get_dir}
4 | \alias{sass_cache_get_dir}
5 | \alias{sass_cache_set_dir}
6 | \title{Get and set the cache object registered for a specific directory}
7 | \usage{
8 | sass_cache_get_dir(dir, create = FALSE)
9 |
10 | sass_cache_set_dir(dir, cache)
11 | }
12 | \arguments{
13 | \item{dir}{A directory. An error will be thrown if the directory does not
14 | exist.}
15 |
16 | \item{create}{If \code{TRUE}, then if the cache directory doesn't exist, or if
17 | there is not a registered cache object for the directory, create them as
18 | needed.}
19 |
20 | \item{cache}{A \code{\link[=sass_file_cache]{sass_file_cache()}} object, or \code{NULL} if you don't want to
21 | unset the cache for a directory.}
22 | }
23 | \description{
24 | Get and set the cache object registered for a specific directory
25 | }
26 | \details{
27 | If \code{sass_cache_get_dir()} is called for a given directory, before
28 | \code{sass_cache_set_dir()} has been called for that directory, then it will
29 | return \code{NULL}.
30 |
31 | After \code{sass_cache_set_dir()} is called for a directory, any future calls to
32 | \code{sass_cache_get_dir()} with that directory will return that specific cache
33 | object. This can be useful if you customize parameters for the cache object,
34 | like maximum size or age.
35 | }
36 | \seealso{
37 | \code{\link[=sass_cache_get]{sass_cache_get()}}, \code{\link[=sass_file_cache]{sass_file_cache()}}, \code{\link[=sass]{sass()}}
38 | }
39 | \keyword{internal}
40 |
--------------------------------------------------------------------------------
/man/sass_cache_options.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/sass_cache.R
3 | \name{sass_cache_options}
4 | \alias{sass_cache_options}
5 | \title{Caching Options for Sass (defunct)}
6 | \usage{
7 | sass_cache_options(cache, cache_dir)
8 | }
9 | \arguments{
10 | \item{cache}{No longer used.}
11 |
12 | \item{cache_dir}{No longer used.}
13 | }
14 | \description{
15 | This function is no longer used. Please see \code{\link[=sass_cache_get]{sass_cache_get()}}.
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/man/sass_file_cache.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/file_cache.R
3 | \name{sass_file_cache}
4 | \alias{sass_file_cache}
5 | \title{Create a file cache object}
6 | \usage{
7 | sass_file_cache(dir, max_size = 40 * 1024^2, max_age = Inf)
8 | }
9 | \arguments{
10 | \item{dir}{The directory in which to store the cached files.}
11 |
12 | \item{max_size}{The maximum size of the cache, in bytes. If the cache grows
13 | past this size, the least-recently-used objects will be removed until it
14 | fits within this size.}
15 |
16 | \item{max_age}{The maximum age of objects in the cache, in seconds. The
17 | default is one week.}
18 | }
19 | \value{
20 | A \link{FileCache} object.
21 | }
22 | \description{
23 | This creates a file cache which is to be used by sass for caching generated
24 | .css files.
25 | }
26 | \examples{
27 | \dontrun{
28 | # Create a cache with the default settings
29 | cache <- sass_file_cache(sass_cache_context_dir())
30 |
31 | # Clear the cache
32 | cache$reset()
33 | }
34 |
35 | }
36 | \seealso{
37 | \code{\link[=sass_cache_get]{sass_cache_get()}}, \code{\link[=sass_cache_context_dir]{sass_cache_context_dir()}}, \link{FileCache}
38 | }
39 |
--------------------------------------------------------------------------------
/man/sass_import.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/as_sass.R
3 | \name{sass_import}
4 | \alias{sass_import}
5 | \alias{sass_file}
6 | \title{Sass Import}
7 | \usage{
8 | sass_import(input, quote = TRUE)
9 |
10 | sass_file(input)
11 | }
12 | \arguments{
13 | \item{input}{Character string to be placed in an import statement.}
14 |
15 | \item{quote}{Logical that determines if a double quote is added to the import
16 | value. Defaults to \code{TRUE}.}
17 | }
18 | \value{
19 | Fully defined Sass import string.
20 | }
21 | \description{
22 | Create an import statement to be used within your Sass file. See
23 | \url{https://sass-lang.com/documentation/at-rules/import} for
24 | more details.
25 | }
26 | \details{
27 | \code{sass_file()} adds extra checks to make sure an appropriate file path
28 | exists given the input value.
29 |
30 | Note that the LibSass compiler expects .sass files to use the Sass Indented
31 | Syntax.
32 | }
33 | \examples{
34 | sass_import("foo")
35 | sass_import("$foo", FALSE)
36 | \donttest{
37 | tmp_scss_file <- tempfile(fileext = ".scss")
38 | writeLines("$color: red; body{ color: $color; }", tmp_scss_file)
39 | sass_file(tmp_scss_file)
40 | sass(sass_file(tmp_scss_file))
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/man/write_file_attachments.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/layers.R
3 | \name{write_file_attachments}
4 | \alias{write_file_attachments}
5 | \title{Write file attachments from a sass theme object}
6 | \usage{
7 | write_file_attachments(file_attachments, output_path)
8 | }
9 | \arguments{
10 | \item{file_attachments}{A character vector of files or directories.}
11 |
12 | \item{output_path}{A directory to copy the attachments to.}
13 | }
14 | \description{
15 | Write file attachments from a sass theme object
16 | }
17 | \keyword{internal}
18 |
--------------------------------------------------------------------------------
/pkgdown/_pkgdown.yml:
--------------------------------------------------------------------------------
1 | url: https://rstudio.github.io/sass/
2 |
3 | template:
4 | params:
5 | docsearch:
6 | api_key: b7f32716c953bf205e00b89772b35d36
7 | index_name: rstudio_sass
8 |
9 | toc:
10 | depth: 2
11 |
12 | navbar:
13 | type: default
14 | left:
15 | - text: Overview
16 | href: articles/sass.html
17 | - text: Reference
18 | href: reference/index.html
19 | - text: News
20 | href: news/index.html
21 |
22 | reference:
23 | - title: Sass compilation
24 | description: |
25 | Tools for invoking and controling Sass -> CSS compilation
26 | contents:
27 | - sass
28 | - sass_options
29 | - output_template
30 | - title: Sass code
31 | description: |
32 | Tools for generating Sass code from R
33 | contents:
34 | - as_sass
35 | - sass_file
36 | - sass_layer
37 | - sass_partial
38 | - title: Caching
39 | description: |
40 | Functions related to caching sass output
41 | contents:
42 | - sass_file_cache
43 | - sass_cache_get
44 | - title: Font importing
45 | description: |
46 | Helpers for importing font files
47 | contents:
48 | - font_face
49 |
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-120x120.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon-120x120.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-152x152.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon-152x152.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-180x180.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon-180x180.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-60x60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon-60x60.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon-76x76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon-76x76.png
--------------------------------------------------------------------------------
/pkgdown/favicon/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/apple-touch-icon.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/favicon-16x16.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/favicon-32x32.png
--------------------------------------------------------------------------------
/pkgdown/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/rstudio/sass/e80e8971c048f71fef1d8b1eae1799b8325dd3be/pkgdown/favicon/favicon.ico
--------------------------------------------------------------------------------
/sass.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: Default
4 | SaveWorkspace: Default
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 | BuildType: Package
19 | PackageUseDevtools: Yes
20 | PackageInstallArgs: --no-multiarch --with-keep.source
21 | PackageCheckArgs: --as-cran
22 | PackageRoxygenize: rd,collate,namespace
23 |
--------------------------------------------------------------------------------
/scripts/apply_libsass_patches.R:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env Rscript
2 | # Applies patches stored in scripts/patches
3 | # Should be run after running scripts/update_libsass.R
4 |
5 | library(rprojroot)
6 |
7 | # Remove libsass test files (the entire `test` directory) since they contain unicode
8 | # directory paths, and R CMD check provides a warning.
9 | unlink(
10 | find_package_root_file("src/libsass/test"),
11 | recursive = TRUE
12 | )
13 |
14 | patch_dir <- find_package_root_file("scripts/patches")
15 |
16 | for (patch in list.files(patch_dir, full.names = TRUE)) {
17 | tryCatch({
18 | message(sprintf("Applying %s", basename(patch)))
19 | system(sprintf("git apply --reject --whitespace=fix '%s'", patch))
20 | },
21 | error = function(e) {
22 | quit(save = "no", status = 1)
23 | }
24 | )
25 | }
26 |
--------------------------------------------------------------------------------
/scripts/build_docs.R:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | (function() {
6 |
7 | owd <- getwd()
8 | on.exit({
9 | setwd(owd)
10 | })
11 |
12 | setwd(devtools::as.package(".")$path)
13 |
14 | devtools::document()
15 |
16 | devtools::install()
17 |
18 | rmarkdown::render("README.Rmd")
19 |
20 | unlink("docs", recursive = TRUE)
21 | pkgdown::build_site()
22 |
23 | })()
24 |
--------------------------------------------------------------------------------
/scripts/patches/001-remove-makefile-pipes.patch:
--------------------------------------------------------------------------------
1 | The order-only prerequisite operators (|) were removed since they cannot be
2 | interpreted by Make 3.79.1 (which is used by Rtools 3.4). There were 3 instances
3 | removed by this patch
4 |
5 | diff --git a/src/libsass/Makefile b/src/libsass/Makefile
6 | index 30023ba..8c4ed4d 100644
7 | --- a/src/libsass/Makefile
8 | +++ b/src/libsass/Makefile
9 | @@ -204,17 +204,17 @@ debug-shared: shared
10 | lib:
11 | $(MKDIR) lib
12 |
13 | -lib/libsass.a: $(COBJECTS) $(OBJECTS) | lib
14 | +lib/libsass.a: $(COBJECTS) $(OBJECTS) lib
15 | $(AR) rcvs $@ $(COBJECTS) $(OBJECTS)
16 |
17 | -lib/libsass.so: $(COBJECTS) $(OBJECTS) | lib
18 | +lib/libsass.so: $(COBJECTS) $(OBJECTS) lib
19 | $(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(LDLIBS)
20 |
21 | -lib/libsass.dylib: $(COBJECTS) $(OBJECTS) | lib
22 | +lib/libsass.dylib: $(COBJECTS) $(OBJECTS) lib
23 | $(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(LDLIBS) \
24 | -install_name @rpath/libsass.dylib
25 |
26 | -lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS) | lib
27 | +lib/libsass.dll: $(COBJECTS) $(OBJECTS) $(RCOBJECTS) lib
28 | $(CXX) -shared $(LDFLAGS) -o $@ $(COBJECTS) $(OBJECTS) $(RCOBJECTS) $(LDLIBS) \
29 | -s -Wl,--subsystem,windows,--out-implib,lib/libsass.a
30 |
31 |
--------------------------------------------------------------------------------
/scripts/patches/003-replace-curdir-with-dot.patch:
--------------------------------------------------------------------------------
1 | An instance of the `CURDIR` builtin variable was removed and simply replaced
2 | with a `.`. This replacement was made to address paths with spaces (which
3 | are common in newer versions of Windows). Make 3.79.1 (used by Rtools 3.4)
4 | in Windows 10, for instance, constructs invalid paths when using `CURDIR`.
5 |
6 | diff --git a/src/libsass/Makefile b/src/libsass/Makefile
7 | index 9255f0d..ee36d92 100644
8 | --- a/src/libsass/Makefile
9 | +++ b/src/libsass/Makefile
10 | @@ -74,7 +74,7 @@ else
11 | endif
12 |
13 | ifndef SASS_LIBSASS_PATH
14 | - SASS_LIBSASS_PATH = $(CURDIR)
15 | + SASS_LIBSASS_PATH = .
16 | endif
17 | ifdef SASS_LIBSASS_PATH
18 | CFLAGS += -I $(SASS_LIBSASS_PATH)/include
19 |
--------------------------------------------------------------------------------
/scripts/patches/005-remove-pragma-marks.patch:
--------------------------------------------------------------------------------
1 | This removes some diagnostic pragma marks that produce a NOTE during
2 | R CMD check.
3 |
4 | diff --git a/src/libsass/src/parser.hpp b/src/libsass/src/parser.hpp
5 | index 25c39b9..c32a54e 100644
6 | --- a/src/libsass/src/parser.hpp
7 | +++ b/src/libsass/src/parser.hpp
8 | @@ -68,9 +68,6 @@ namespace Sass {
9 | // branches. This is not a bug, just a merging of behaviour into
10 | // one function
11 |
12 | -#pragma clang diagnostic push
13 | -#pragma clang diagnostic ignored "-Wtautological-compare"
14 | -
15 | #endif
16 |
17 |
18 | @@ -227,8 +224,6 @@ namespace Sass {
19 |
20 | #ifdef __clang__
21 |
22 | -#pragma clang diagnostic pop
23 | -
24 | #endif
25 |
26 | void error(sass::string msg);
27 |
--------------------------------------------------------------------------------
/scripts/patches/006-add-newline-fn_numbers.patch:
--------------------------------------------------------------------------------
1 | This adds a newline to the end of file. Lack of a terminating newline
2 | produces a NOTE during R CMD check.
3 |
4 | diff --git a/src/libsass/src/fn_numbers.hpp b/src/libsass/src/fn_numbers.hpp
5 | index dba96be..67bec46 100644
6 | --- a/src/libsass/src/fn_numbers.hpp
7 | +++ b/src/libsass/src/fn_numbers.hpp
8 | @@ -42,4 +42,4 @@ namespace Sass {
9 |
10 | }
11 |
12 | -#endif
13 | \ No newline at end of file
14 | +#endif
15 |
--------------------------------------------------------------------------------
/scripts/patches/007-add-newline-sass_functions.patch:
--------------------------------------------------------------------------------
1 | This adds a newline to the end of file. Lack of a terminating newline
2 | produces a NOTE during R CMD check.
3 |
4 | diff --git a/src/libsass/src/sass_functions.hpp b/src/libsass/src/sass_functions.hpp
5 | index 482ed64..bed9560 100644
6 | --- a/src/libsass/src/sass_functions.hpp
7 | +++ b/src/libsass/src/sass_functions.hpp
8 | @@ -47,4 +47,4 @@ struct Sass_Importer {
9 | void* cookie;
10 | };
11 |
12 | -#endif
13 | \ No newline at end of file
14 | +#endif
15 |
--------------------------------------------------------------------------------
/scripts/patches/008-gcc-12-address-warnings:
--------------------------------------------------------------------------------
1 | Avoids some warning messages from gcc-12 that CRAN doesn't like. Example:
2 | src/lexer.hpp:89:15: warning: the address of ‘Sass::Constants::warn_kwd’ will never be NULL [-Waddress]
3 |
4 | Basically the compiler statically knows whether the str is NULL, and doesn't like
5 | there being code that checks. Adding a template specialization for the null case
6 | lets us remove the check.
7 |
8 |
9 | diff --git a/src/libsass/src/lexer.hpp b/src/libsass/src/lexer.hpp
10 | index 360ed22..e4091f4 100644
11 | --- a/src/libsass/src/lexer.hpp
12 | +++ b/src/libsass/src/lexer.hpp
13 | @@ -86,7 +86,6 @@ namespace Sass {
14 | // Regex equivalent: /(?:literal)/
15 | template