Skip to content

Commit 4617ace

Browse files
committed
doc: first tutorial for create a first app
1 parent 43579d5 commit 4617ace

File tree

4 files changed

+134
-1
lines changed

4 files changed

+134
-1
lines changed

pkgdown/_pkgdown.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,34 @@ navbar:
2626
bg: info
2727
type: light
2828
structure:
29-
left: [reference, articles, resources, news]
29+
left: [reference, tuto, topics, contribute, resources]
3030
right: [github, golemverse]
3131
components:
32+
tuto:
33+
text: Tutorials
34+
menu:
35+
- text: Create your first Golem application
36+
href: articles/tuto/first-golem-app.html
37+
- text: Add your first module and communication
38+
href: ~
39+
topics:
40+
text: Advanced topics
41+
menu:
42+
- text: -------
43+
- text: UI
44+
- text: Use a maintenance page
45+
href: ~
46+
- text: Use bslib
47+
href: ~
48+
- text: -------
49+
- text: Backend
50+
- text: Add routing
51+
href: ~
52+
- text: TODO
53+
href: ~
54+
contribute:
55+
text: Contribute
56+
href: ~
3257
golemverse:
3358
icon: fas fa-toolbox
3459
href: https://golemverse.org/

pkgdown/extra.scss

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,47 @@
2020
padding: 1.5px 2px;
2121
border-radius: 4px;
2222
}
23+
24+
/* ---- Callouts ---- */
25+
.callout {
26+
position: relative;
27+
border: 1px solid var(--bs-primary);
28+
padding: 1rem 2rem;
29+
margin: 1rem 0;
30+
border-radius: var(--bs-border-radius);
31+
display: flex;
32+
flex-direction: row;
33+
align-items: center;
34+
gap: 3rem;
35+
background: #7176b817;
36+
37+
p {
38+
margin: auto;
39+
}
40+
}
41+
42+
@mixin callout($content, $color) {
43+
&::before {
44+
content: $content;
45+
font-weight: bold;
46+
font-size: 1.25rem;
47+
font-style: italic;
48+
font-family: serif;
49+
border-radius: 50%;
50+
color: var(--bs-body-bg);
51+
background-color: $color;
52+
width: 3rem;
53+
height: 2rem;
54+
display: inline-flex;
55+
align-items: center;
56+
justify-content: center;
57+
}
58+
}
59+
60+
.callout.callout-note {
61+
@include callout("i", var(--bs-primary));
62+
}
63+
64+
.callout.callout-danger {
65+
@include callout("!", var(--bs-warning));
66+
}

vignettes/tuto/first-golem-app.Rmd

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: "Create your first Golem Application"
3+
output: rmarkdown::html_vignette
4+
vignette: >
5+
%\VignetteIndexEntry{Create your first Golem Application}
6+
%\VignetteEngine{knitr::rmarkdown}
7+
%\VignetteEncoding{UTF-8}
8+
---
9+
10+
# Create a new application with `golem`
11+
12+
First, you need to install the `golem` package.
13+
14+
## Installing {golem}
15+
16+
You can install the stable version of `{golem}` from CRAN:
17+
18+
``` {r eval=FALSE}
19+
install.packages("golem")
20+
```
21+
22+
The development version of `{golem}` can be installed from GitHub using the `{remotes}` package:
23+
```{r eval=FALSE}
24+
remotes::install_github("Thinkr-open/golem")
25+
```
26+
27+
## Getting started
28+
29+
Note before using `golem`:
30+
31+
- A `golem` app is contained inside a package, so knowing how to build a package is highly recommended. On the plus side, everything you know about package development can be reused in `golem`.
32+
33+
- A `golem` app works better if you are working with `shiny modules`, so knowing how modules work is recommended, but not mandatory.
34+
35+
A dedicated articles on modules is available [here](https://shiny.rstudio.com/articles/modules.html). And more specifically on how to use modules with `golem` [here]().
36+
37+
## Create a package
38+
39+
In case you are using RStudio, you can use the `golem` RStudio addin to create a new application.
40+
41+
Go to `File` > `New Project` > `New Directory` > Search for `Package for Shiny App using golem`:
42+
43+
```{r, echo=FALSE, out.width="80%", eval=TRUE}
44+
knitr::include_graphics("golemtemplate.png")
45+
```
46+
47+
You can also create a new application with the following R code:
48+
49+
```{r eval = FALSE}
50+
golem::create_golem(path = "path/to/package/mygolemapp")
51+
```
52+
53+
::: {.callout .callout-danger}
54+
::: {.callout-body}
55+
By passing the `check_name` argument to `FALSE`, this command allows you to create "illegally-named" package (for example, `1234`).
56+
57+
Note that this is not recommended and __should only be done if you know what you are doing__.
58+
:::
59+
:::
60+
61+
Run this code in your R console will create a new golem application in a package called `mygolemapp` in the folder `path/to/package`.
62+
63+
A new Rstudio window will open with the new project.
64+

vignettes/tuto/golemtemplate.png

40.6 KB
Loading

0 commit comments

Comments
 (0)