File: uglifyjs.R

package info (click to toggle)
r-cran-bookdown 0.21%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,084 kB
  • sloc: javascript: 11,155; sh: 33; makefile: 17
file content (9 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
uglifyjs = function(file, args = NULL) {
  if (Sys.which('uglifyjs') == '') return(1)
  owd = setwd(dirname(file)); on.exit(setwd(owd), add = TRUE)
  file = basename(file)
  out = shQuote(xfun::with_ext(file, '.min.js'))
  system2('uglifyjs', c(shQuote(file), '--source-map', '-o', out, args))
}

xfun::in_dir('inst/resources/gitbook/js', uglifyjs('app.js'))