Node.js is a runtime environment which
can execute JavaScript code outside a web browser. It is used widely for
web development. Its package manager,
npm, makes it easy to install
virtually any JavaScript library. You can use other package managers such as
bun and pnpm that are compatible with
npm
.
To switch from the default npm usage, set a global environment variable named
RHINO_NPM
. For instance, if you want to use bun
instead of npm
,
add export RHINO_NPM=bun
to your shell startup file (e.g. .bashrc
).
Rhino uses Node.js to provide state of the art tools for working with JavaScript and Sass. The following functions require Node.js to work:
build_js()
build_sass()
(with sass: node
configuration in rhino.yml
)lint_js()
lint_sass()
test_e2e()
Under the hood Rhino will create a .rhino
directory in your
project to store the specific libraries needed by these tools. This
directory is git-ignored by default and safe to remove.
Node can be installed in various ways. One of them relies on
nvm
(Node Version Manager).
There's a known issue
when using multiple versions of Node
that were installed with nvm
that
causes RStudio to not recognize properly the chosen version. It's caused
by nvm
and RStudio and can be easily mitigated by starting the RStudio
through the terminal:
Ubuntu/Debian Open your terminal of choice (i.e. Bash) and run
rstudio
Windows Open your Windows terminal of choice (i.e. Terminal, PowerShell, Git Bash) and run:
path/to/your/rstudio/folder/Rstudio.exe
Mac Open your Mac terminal of choice (i.e. default Terminal) and run:
open -na Rstudio
The build_sass()
function is worth an additional comment. Depending on
the configuration in rhino.yml
it can use either the
sass Node.js package or the
sass R package. We recommend the
Node.js version, as it is the primary, actively developed implementation
of Sass. In contrast, the R package uses the deprecated
LibSass
implementation.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.