uglify.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * `tasks/config/uglify`
  3. *
  4. * ---------------------------------------------------------------
  5. *
  6. * Minify client-side JavaScript files using UglifyES.
  7. *
  8. * For more information, see:
  9. * https://sailsjs.com/anatomy/tasks/config/uglify.js
  10. *
  11. */
  12. module.exports = function(grunt) {
  13. grunt.config.set('uglify', {
  14. dist: {
  15. src: ['.tmp/public/concat/production.js'],
  16. dest: '.tmp/public/min/production.min.js'
  17. },
  18. options: {
  19. mangle: {
  20. reserved: [
  21. 'AsyncFunction',
  22. 'SailsSocket',
  23. 'Promise',
  24. 'File',
  25. 'Location',
  26. 'RttcRefPlaceholder',
  27. ],
  28. keep_fnames: true//eslint-disable-line
  29. },
  30. compress: {
  31. keep_fnames: true//eslint-disable-line
  32. }
  33. }
  34. });
  35. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  36. // This Grunt plugin is part of the default asset pipeline in Sails,
  37. // so it's already been automatically loaded for you at this point.
  38. //
  39. // Of course, you can always remove this Grunt plugin altogether by
  40. // deleting this file. But check this out: you can also use your
  41. // _own_ custom version of this Grunt plugin.
  42. //
  43. // Here's how:
  44. //
  45. // 1. Install it as a local dependency of your Sails app:
  46. // ```
  47. // $ npm install grunt-contrib-uglify --save-dev --save-exact
  48. // ```
  49. //
  50. //
  51. // 2. Then uncomment the following code:
  52. //
  53. // ```
  54. // // Load Grunt plugin from the node_modules/ folder.
  55. // grunt.loadNpmTasks('grunt-contrib-uglify');
  56. // ```
  57. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  58. };