2
0

gruntfile.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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/*/specs/*.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. options: {
  46. bundleOptions: {
  47. standalone: 'Vue'
  48. }
  49. },
  50. build: {
  51. src: ['src/vue.js'],
  52. dest: 'dist/vue.js'
  53. },
  54. watch: {
  55. src: ['src/vue.js'],
  56. dest: 'dist/vue.js',
  57. options: {
  58. watch: true,
  59. keepAlive: true
  60. }
  61. }
  62. }
  63. })
  64. // load npm tasks
  65. grunt.loadNpmTasks('grunt-contrib-jshint')
  66. grunt.loadNpmTasks('grunt-karma')
  67. grunt.loadNpmTasks('grunt-browserify')
  68. // load custom tasks
  69. grunt.file.recurse('tasks', function (path) {
  70. require('./' + path)(grunt)
  71. })
  72. grunt.registerTask('unit', ['karma:browsers'])
  73. grunt.registerTask('phantom', ['karma:phantom'])
  74. grunt.registerTask('watch', ['browserify:watch'])
  75. grunt.registerTask('build', ['browserify:build'])
  76. }