gruntfile.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. module.exports = function (grunt) {
  2. grunt.initConfig({
  3. jshint: {
  4. options: {
  5. reporter: require('jshint-stylish'),
  6. jshintrc: true
  7. },
  8. build: {
  9. src: ['gruntfile.js', 'tasks/*.js']
  10. },
  11. src: {
  12. src: 'src/**/*.js'
  13. },
  14. test: {
  15. src: 'test/**/*.js'
  16. }
  17. },
  18. karma: {
  19. options: {
  20. frameworks: ['jasmine', 'commonjs'],
  21. files: [
  22. 'src/**/*.js',
  23. 'test/unit/**/*.js'
  24. ],
  25. preprocessors: {
  26. 'src/**/*.js': ['commonjs'],
  27. 'test/unit/**/*.js': ['commonjs']
  28. },
  29. singleRun: true
  30. },
  31. browsers: {
  32. options: {
  33. browsers: ['Chrome', 'Firefox'],
  34. reporters: ['progress']
  35. }
  36. },
  37. phantom: {
  38. options: {
  39. browsers: ['PhantomJS'],
  40. reporters: ['progress']
  41. }
  42. }
  43. },
  44. browserify: {
  45. build: {
  46. src: ['src/vue.js'],
  47. dest: 'dist/vue.js',
  48. options: {
  49. bundleOptions: {
  50. standalone: 'Vue'
  51. }
  52. }
  53. },
  54. watch: {
  55. src: ['src/vue.js'],
  56. dest: 'dist/vue.js',
  57. options: {
  58. watch: true,
  59. keepAlive: true,
  60. bundleOptions: {
  61. standalone: 'Vue'
  62. }
  63. }
  64. },
  65. bench: {
  66. src: ['benchmarks/*.js', '!benchmarks/browser.js'],
  67. dest: 'benchmarks/browser.js'
  68. }
  69. }
  70. })
  71. // load npm tasks
  72. grunt.loadNpmTasks('grunt-contrib-jshint')
  73. grunt.loadNpmTasks('grunt-karma')
  74. grunt.loadNpmTasks('grunt-browserify')
  75. // load custom tasks
  76. grunt.file.recurse('tasks', function (path) {
  77. require('./' + path)(grunt)
  78. })
  79. grunt.registerTask('unit', ['karma:browsers'])
  80. grunt.registerTask('phantom', ['karma:phantom'])
  81. grunt.registerTask('watch', ['browserify:watch'])
  82. grunt.registerTask('build', ['browserify:build'])
  83. }