Advertisement
Guest User

Untitled

a guest
Sep 1st, 2014
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. 1. a.js
  2. 2. b.js
  3. 3. c.js
  4.  
  5. 1. a.min.js
  6. 2. b.min.js
  7. 3. c.min.js
  8.  
  9. min: {
  10. dist: {
  11. src: 'js/**/*.js',
  12. dest: 'js/min/xxx.min.js'
  13. }
  14. }
  15.  
  16. uglify: {
  17. build: {
  18. files: [{
  19. expand: true,
  20. src: '**/*.js',
  21. dest: 'build/scripts',
  22. cwd: 'app/scripts'
  23. }]
  24. }
  25. }
  26.  
  27. uglify: {
  28. dist: {
  29. files: {
  30. 'dist/main.js': 'src/main.js',
  31. 'dist/widget.js': 'src/widget.js'
  32. }
  33. }
  34. }
  35.  
  36. min: {
  37. files: grunt.file.expandMapping(['path/*.js', 'path2/*.js'], 'destination/', {
  38. rename: function(destBase, destPath) {
  39. return destBase+destPath.replace('.js', '.min.js');
  40. }
  41. })
  42. }
  43.  
  44. min: {
  45. min_a: {
  46. src: 'a.js',
  47. dest: 'a.min.js'
  48. },
  49. min_b: {
  50. src: 'b.js',
  51. dest: 'b.min.js'
  52. },
  53. min_c: {
  54. src: 'c.js',
  55. dest: 'c.min.js'
  56. }
  57.  
  58. module.exports = function(grunt) {
  59.  
  60. // Project configuration.
  61. grunt.initConfig({
  62. pkg: grunt.file.readJSON('package.json'),
  63. uglify: {
  64. build: {
  65. files: [{
  66. expand: true,
  67. src: '**/*.js',
  68. dest: 'build/scripts',
  69. cwd: 'public_html/app',
  70. ext: '.min.js'
  71. }]
  72. }
  73. }
  74. });
  75.  
  76. // Load the plugin that provides the "uglify" task.
  77. grunt.loadNpmTasks('grunt-contrib-uglify');
  78.  
  79. // Default task(s).
  80. grunt.registerTask('default', ['uglify']);
  81.  
  82. };
  83.  
  84. copy: {
  85. dist: {
  86. src: 'a.js',
  87. dest: 'a.min.js'
  88. }
  89. },
  90. minidirect: {
  91. all: 'js/min/*.min.js'
  92. }
  93.  
  94. var filesA = 'a.js', filesB = 'b.js', filesC = 'c.js';
  95.  
  96. ...
  97.  
  98. min: {
  99. min_a: {
  100. src: filesA,
  101. dest: 'a.min.js'
  102. },
  103. min_b: {
  104. src: filesB,
  105. dest: 'b.min.js'
  106. },
  107. min_c: {
  108. src: filesC,
  109. dest: 'c.min.js'
  110. }
  111.  
  112. watch: {
  113. min_a: {
  114. files: filesA,
  115. tasks: ['min:min_a']
  116. },
  117. min_b: {
  118. files: filesB,
  119. tasks: ['min:min_b']
  120. },
  121. min_c: {
  122. files: filesC,
  123. tasks: ['min:min_c']
  124. }
  125. }
  126.  
  127. uglify: {
  128. dist: {
  129. files: [{
  130. expand: true,
  131. src: '**/*.js',
  132. dest: 'destdir',
  133. cwd: 'srcdir',
  134. rename: function(dest, src) { return dest + '/' + src.replace('.js', '.min.js'); }
  135. }]
  136. }
  137. },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement