Skip to content

Commit

Permalink
Merge pull request #34 from kyleGrealis/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kyleGrealis authored Jan 7, 2025
2 parents 7956550 + bdef7e1 commit 20b9063
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 69 deletions.
4 changes: 0 additions & 4 deletions R/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,11 @@ ensure_auxiliary_files <- function(path) {
# Handle custom.scss
if (!file.exists(scss_path)) {
write_scss(path = path, name = 'custom')
} else {
ui_info("'custom.scss' already exists. No changes made.")
}

# Handle _quarto.yml
if (!file.exists(quarto_yml_path)) {
writeLines("project:\n title: \"Quarto Project\"", quarto_yml_path)
ui_done("Created '_quarto.yml'")
} else {
ui_info("'_quarto.yml' already exists. No changes made.")
}
}
6 changes: 1 addition & 5 deletions R/write_scss.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
#' \item Provides instructions for adding SCSS files to Quarto YAML
#' }
#'
#' For more information on customizing Quarto documents with SCSS, please refer to
#' \url{https://quarto.org/docs/output-formats/html-themes.html#customizing-themes},
#' \url{https://quarto.org/docs/output-formats/html-themes-more.html}, and
#' \url{https://github.com/twbs/bootstrap/blob/main/scss/_variables.scss} will provide
#' you with over 1500 lines of SCSS variables.
#' See \code{vignette("customizing-quarto", package = "froggeR")} vignette for more help.
#'
#' @param name The name of the scss file without extension. Default \code{name} is
#' "custom".
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ froggeR::quarto_project(
```

This creates:

* A Quarto document with custom YAML
* A comprehensive `.gitignore`
* A structured `README.md`
Expand All @@ -100,6 +101,7 @@ froggeR::froggeR_settings()

Interactively create or update metadata that is reusable across Quarto projects &
documents with:

* Author details
* Contact information
* Affiliations
Expand All @@ -126,6 +128,7 @@ froggeR::write_ignore()
```

Automatically excludes:

* R data files (`.RData`, `.rda`, `.rds`)
* Common data formats (CSV, Excel, text files)
* Sensitive information
Expand All @@ -139,6 +142,7 @@ froggeR::write_scss()
```

Provides a formatted stylesheet with:

* SCSS defaults
* SCSS mixins
* SCSS rules
Expand All @@ -154,6 +158,7 @@ froggeR::write_readme()
```

Includes sections for:

* Project overview
* Setup instructions
* File and directory explanations
Expand Down
13 changes: 7 additions & 6 deletions inst/gists/basic_quarto.qmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
title: "Title"
author:
name: "First Last"
url: "" # i.e., GitHub or company URL (optional)
email: ""
orcid: "" # add your ORCID (optional)
roles: "" # aut, cre, cont (optional)
name: "First Last"
url: "" # i.e., GitHub or company URL (optional)
email: ""
orcid: "" # add your ORCID (optional)
roles: "" # aut, cre, cont (optional)
affiliations: ""
date: last-modified
abstract: ""
keywords: "" # add keywords like "research" or "public health"
number-sections: false
Expand All @@ -15,7 +16,7 @@ format:
embed-resources: true
theme:
- default
- custom.scss
# - custom.scss # Uncomment if needed
toc: true
toc-title: "Table of Contents"
toc-location: left
Expand Down
13 changes: 7 additions & 6 deletions inst/gists/custom_quarto.qmd
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
title: "Title"
author:
name: "{{< var name >}}"
url: "{{< var url >}}"
email: "{{< var email >}}"
orcid: "{{< var orcid >}}"
roles: "{{< var roles >}}"
affiliations: "{{< var affiliations >}}"
name: "{{< var name >}}"
url: "{{< var url >}}"
email: "{{< var email >}}"
orcid: "{{< var orcid >}}"
roles: "{{< var roles >}}"
affiliations: "{{< var affiliations >}}"
date: last-modified
abstract: ""
keywords: "" # add keywords like "research" or "public health"
number-sections: false
Expand Down
6 changes: 1 addition & 5 deletions man/write_scss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 5 additions & 38 deletions vignettes/customizing-quarto.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ knitr::opts_chunk$set(
)
```

## Introduction 🐸
## Introduction

One of `froggeR`'s core strengths is its ability to maintain consistent settings and styling across multiple projects. This vignette demonstrates how to set up and customize your Quarto documents using `froggeR`'s powerful configuration system.

Expand Down Expand Up @@ -143,6 +143,7 @@ format:
html:
theme:
- default
- custom.scss # Added during project
- modern_theme.scss # Or presentation_theme.scss
---
```
Expand Down Expand Up @@ -279,49 +280,15 @@ a:not(.nav-link) {
* Existing projects keep their settings
* Update `_variables.yml` manually if needed

### Styling Problems

1. **Styles Not Applying**
* Verify `custom.scss` is listed in YAML under `theme`
* Check file location (should be in project root)
* Ensure no syntax errors in SCSS
* Try clearing Quarto cache

2. **Font Issues**

```yaml
format:
html:
mainfont: "Open Sans"
monofont: "Fira Code"
theme:
- custom.scss
```
* Include Google Fonts in YAML
* Check font name spelling
* Use web-safe fallbacks
3. **Variable Scope**
* Define all variables in `scss:defaults`
* Reference variables after definition
* Use proper SCSS syntax (`$variable`)

### SCSS File Management

1. **Project Creation vs. Individual Documents**
* `quarto_project()` automatically creates `custom.scss`
* `write_quarto()` uses existing `custom.scss` if available
* For standalone documents, manually create SCSS with `write_scss()`

----

## Additional Resources

For more advanced SCSS customization options, visit:

* [Quarto HTML Themes](https://quarto.org/docs/output-formats/html-themes.html#customizing-themes)
* [More Theme Options](https://quarto.org/docs/output-formats/html-themes-more.html)
* [Bootstrap Variables](https://github.com/twbs/bootstrap/blob/main/scss/_variables.scss)
* [Quarto HTML Themes](https://quarto.org/docs/output-formats/html-themes.html#customizing-themes){target="_blank"}
* [More Theme Options](https://quarto.org/docs/output-formats/html-themes-more.html){target="_blank"}
* [Bootstrap Variables](https://github.com/twbs/bootstrap/blob/main/scss/_variables.scss){target="_blank"}

----

Expand Down
9 changes: 5 additions & 4 deletions vignettes/hopping-into-quarto.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ knitr::opts_chunk$set(
)
```

## Introduction 🐸
## Introduction

`froggeR` streamlines Quarto workflows by providing a robust, user-friendly framework for project setup and document creation. This vignette demonstrates how `froggeR` can enhance your productivity while maintaining project consistency.

Expand Down Expand Up @@ -90,8 +90,9 @@ froggeR::write_quarto(
Customize your document appearance with SCSS:

```r
# Create or modify style sheets
froggeR::write_scss(name = "custom")
froggeR::write_notes()
froggeR::write_readme()
```

This creates a `custom.scss` file with commented-out examples. Uncomment and modify these to customize your document's appearance. For more information on Quarto styling, refer to:
Expand Down Expand Up @@ -151,13 +152,13 @@ For optimal results with `froggeR`:

2. **Q: The SCSS styles aren't applying to my document.**

A: Make sure the SCSS file is properly linked in your YAML header. Check the console for any error messages during rendering.
A: Make sure the SCSS file is properly linked in your YAML header. Remember, the order of the styles sheets matters. During the initialization of `froggeR::write_quarto(custom_yaml = TRUE)`, the `custom.scss` will override anything set in the `default` styling. The same applies if another SCSS sheet is added -- it will override all SCSS files listed above it. Check the console for any error messages during rendering.

3. **Q: I'm getting an error when trying to create a new project.**

A: Ensure you have the latest version of froggeR and Quarto installed. Also, check if you have write permissions in the target directory.

### Tips for Smooth Hopping
### Tips for Smoother Projects

- Always review the generated files after project creation to ensure everything is set up as expected.
- When customizing SCSS, make small changes and render frequently to see the effects.
Expand Down
5 changes: 4 additions & 1 deletion vignettes/quarto-workflow.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Your new project includes:
| `frogs.Rproj` | RStudio project file |
| `_variables.yml` | Reusable document settings |
| `custom.scss` | Style sheet template |
| `dated_progress_notes.md` | Project documentation |
| `README.md` | Project documentation |
| `.gitignore` | Enhanced security settings |

Expand All @@ -67,6 +68,7 @@ Each component serves a specific purpose:
* Links to your styling
* Ready for content


2. **Project Settings** (`_variables.yml`)

```yaml
Expand Down Expand Up @@ -181,7 +183,7 @@ Best practices for project organization:
)
froggeR::write_quarto(
filename = "analysis",
filename = "frogs",
custom_yaml = TRUE
)
```
Expand All @@ -195,6 +197,7 @@ Best practices for project organization:
├── analysis.qmd
├── _variables.yml
├── custom.scss
├── dated_progress_notes.md
└── README.md
```

Expand Down

0 comments on commit 20b9063

Please sign in to comment.