File: uglifyjs.R

package info (click to toggle)
r-cran-bookdown 0.32%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,664 kB
  • sloc: javascript: 11,322; makefile: 21; sh: 20
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'))