Advertisement
Guest User

Untitled

a guest
May 27th, 2015
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. module.exports = function(grunt) {
  2.  
  3. // 1. All configuration goes here
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6.  
  7. concat: {
  8. // 2. Configuration for concatinating files goes here.
  9. dist: {
  10. src: [
  11. 'library/js/libs/*.js', // All JS in the libs folder
  12. 'library/js/custom-scripts.js', // Custom Scripts
  13. ],
  14. dest: 'dist/js/production.js'
  15. }
  16. },
  17. uglify: {
  18. build: {
  19. src: 'dist/js/production.js',
  20. dest: 'dist/js/production.min.js'
  21. }
  22. },
  23. imagemin: {
  24. png: {
  25. options: {
  26. optimizationLevel: 7
  27. },
  28. files: [
  29. {
  30. expand: true,
  31. cwd: 'library/img/',
  32. src: ['**/*.png'],
  33. dest: 'dist/img',
  34. ext: '.png'
  35. }
  36. ]
  37. },
  38. jpg: {
  39. options: {
  40. progressive: true
  41. },
  42. files: [
  43. {
  44. expand: true,
  45. cwd: 'library/img/',
  46. src: ['**/*.jpg'],
  47. dest: 'dist/img',
  48. ext: '.jpg'
  49. }
  50. ]
  51. }
  52. },
  53. less: {
  54. development: {
  55. options: {
  56. compress: true,
  57. yuicompress: false,
  58. cleancss: true,
  59. paths: ["less"]
  60. },
  61. files: {
  62. "dist/css/production.css": "library/less/global.less"
  63. }
  64. }
  65. },
  66. cssmin: {
  67. add_banner: {
  68. options: {
  69. banner: '/* Minified CSS File*/'
  70. },
  71. files: {
  72. "dist/css/production.min.css": "dist/css/production.css"
  73. }
  74. }
  75. },
  76. autoprefixer: {
  77. options: {
  78. // Task-specific options go here.
  79. },
  80. your_target: {
  81. src: 'dist/css/production.min.css'
  82. }
  83. },
  84. watch: {
  85. options: {
  86. livereload: true
  87. },
  88. src: {
  89. files: ['*.php', 'library/functions/*.php']
  90. },
  91. scripts: {
  92. files: ['library/js/libs/*.js', 'library/js/*.js', 'includes/*.php', 'includes/loops/*.php'],
  93. tasks: ['concat', 'uglify'],
  94. options: {
  95. spawn: false
  96. }
  97. },
  98. css: {
  99. files: ['library/less/*.less', 'library/less/bootstrap/*less', 'library/less/imports/*less'],
  100. tasks: ['less','cssmin', 'autoprefixer'],
  101. options: {
  102. spawn: false,
  103. debounceDelay: 250
  104. }
  105. }
  106. }
  107. });
  108.  
  109. // 3. Where we tell Grunt we plan to use this plug-in.
  110. grunt.loadNpmTasks('grunt-contrib-concat');
  111. grunt.loadNpmTasks('grunt-contrib-uglify');
  112. grunt.loadNpmTasks('grunt-contrib-imagemin');
  113. grunt.loadNpmTasks('grunt-contrib-less');
  114. grunt.loadNpmTasks('grunt-contrib-watch');
  115. grunt.loadNpmTasks('grunt-contrib-cssmin');
  116. grunt.loadNpmTasks('grunt-autoprefixer');
  117.  
  118.  
  119. // 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
  120. grunt.registerTask('default', ['watch', 'concat', 'uglify', 'imagemin', 'autoprefixer']);
  121.  
  122. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement