Gruntfile.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. pkg: grunt.file.readJSON('package.json'), // the package file to use
  4. uglify: {
  5. files: {
  6. expand: true,
  7. flatten: true,
  8. src: 'src/js/*.js',
  9. dest: 'dist',
  10. ext: '.min.js'
  11. }
  12. },
  13. cssmin: {
  14. minify: {
  15. expand: true,
  16. cwd: 'src/css',
  17. src: ['*.css', '!*.min.css'],
  18. dest: 'dist',
  19. ext: '.min.css'
  20. }
  21. },
  22. qunit: {
  23. all: ['tests/*.html']
  24. },
  25. watch: {
  26. files: ['tests/*.js', 'tests/*.html', 'src/**'],
  27. tasks: ['default']
  28. },
  29. copy: {
  30. main: {
  31. files: [
  32. // copy dist to tests
  33. // { expand: true, cwd: 'dist', src: '*', dest: 'tests/lib/' },
  34. { expand: true, cwd: 'src/css', src: '*', dest: 'tests/lib/' },
  35. { expand: true, cwd: 'src/js', src: '*', dest: 'tests/lib/' },
  36. // copy latest libs to tests
  37. { expand: true, cwd: 'public/bower_components/jquery', src: 'jquery.js', dest: 'tests/lib/' },
  38. { expand: true, cwd: 'public/bower_components/bootstrap-datepicker/js', src: 'bootstrap-datepicker.js', dest: 'tests/lib/' },
  39. // copy src to example
  40. { expand: true, cwd: 'src/css', src: '*', dest: 'public/css/' },
  41. { expand: true, cwd: 'src/js', src: '*', dest: 'public/js/' }
  42. ]
  43. }
  44. }
  45. });
  46. // load up your plugins
  47. grunt.loadNpmTasks('grunt-contrib-uglify');
  48. grunt.loadNpmTasks('grunt-contrib-cssmin');
  49. grunt.loadNpmTasks('grunt-contrib-qunit');
  50. grunt.loadNpmTasks('grunt-contrib-watch');
  51. grunt.loadNpmTasks('grunt-contrib-copy');
  52. // register one or more task lists (you should ALWAYS have a "default" task list)
  53. grunt.registerTask('default', ['uglify','cssmin', 'copy', 'qunit', 'watch']);
  54. grunt.registerTask('test', 'qunit');
  55. };