Explanation: Node.js - JavaScript and Sass tools
Source:vignettes/explanation/node-js-javascript-and-sass-tools.Rmd
node-js-javascript-and-sass-tools.Rmd
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.
Rhino uses Node.js to provide state of the art tools for working with JavaScript and Sass. In the future it might also become an easy way to add any JS library to your Shiny app.
The following functions require Node.js to work:
build_js()
-
build_sass()
(withsass: node
configuration inrhino.yml
) lint_js()
lint_sass()
test_e2e()
You don’t need to worry about Node.js most of the time. You need to install it on your system along with yarn (an alternative package manager for Node.js). The rest will be handled automatically.
Under the hood Rhino will create a .rhino/node
directory
in your project to store the specific libraries needed by these tools.
This directory is git-ignored by default and safe to remove.
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.