Skip to content

Commit b39fcc7

Browse files
committed
Add minified shiny.js
1 parent a401553 commit b39fcc7

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

R/shinyui.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ renderPage <- function(ui, connection, showcase=0) {
4040
htmlDependency("json2", "2014.02.04", c(href="shared"), script = "json2-min.js"),
4141
htmlDependency("jquery", "1.11.0", c(href="shared"), script = "jquery.min.js"),
4242
htmlDependency("shiny", packageVersion("shiny"), c(href="shared"),
43-
script = "shiny.js", stylesheet = "shiny.css")
43+
script = "shiny.min.js", stylesheet = "shiny.css")
4444
),
4545
result$dependencies
4646
)

inst/www/shared/shiny.min.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inst/www/shared/shiny.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/Gruntfile.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ module.exports = function(grunt) {
55
grunt.initConfig({
66
pkg: pkgInfo(),
77
uglify: {
8-
// NOTE: Don't run shiny minification yet
9-
// shiny: {
10-
// options: {
11-
// banner: '/*! <%= pkg.name %> <%= pkg.version %> | ' +
12-
// '(c) 2012-<%= grunt.template.today("yyyy") %> RStudio, Inc. | ' +
13-
// 'License: <%= pkg.license %> */\n'
14-
// },
15-
// src: srcdir + 'www/shared/<%= pkg.name %>.js',
16-
// dest: srcdir + 'www/shared/<%= pkg.name %>.min.js'
17-
// },
8+
shiny: {
9+
options: {
10+
banner: '/*! <%= pkg.name %> <%= pkg.version %> | ' +
11+
'(c) 2012-<%= grunt.template.today("yyyy") %> RStudio, Inc. | ' +
12+
'License: <%= pkg.license %> */\n',
13+
sourceMap: true
14+
},
15+
src: srcdir + 'www/shared/<%= pkg.name %>.js',
16+
dest: srcdir + 'www/shared/<%= pkg.name %>.min.js'
17+
},
1818
datepicker: {
1919
src: [
2020
srcdir + 'www/shared/datepicker/js/bootstrap-datepicker.js',
@@ -32,9 +32,8 @@ module.exports = function(grunt) {
3232

3333
watch: {
3434
shiny: {
35-
files: '<%= jshint.shiny.src %>',
36-
// tasks: ['newer:jshint:shiny', 'newer:uglify:shiny']
37-
tasks: ['newer:jshint:shiny']
35+
files: '<%= uglify.shiny.src %>',
36+
tasks: ['newer:jshint:shiny', 'newer:uglify:shiny']
3837
},
3938
datepicker: {
4039
files: '<%= uglify.datepicker.src %>',

tools/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ It's also useful to run `grunt` so that it monitors files for changes and run ta
2828
```
2929
grunt watch
3030
```
31+
32+
One of the tasks minifies `shiny.js` to generate `shiny.min.js`. The minified file is supplied to the browser, along with a source map file, `shiny.min.js.map`, which allows a user to view the original Javascript source when using the debugging console in the browser.
33+
34+
During development of Shiny's Javascript code, it's best to use `grunt watch` so that the minified file will get updated whenever you make changes to `shiny.js`.

0 commit comments

Comments
 (0)