Gruntfile.coffee 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. module.exports = (grunt) ->
  2. grunt.initConfig
  3. pkg: grunt.file.readJSON 'package.json'
  4. bower_path: 'bower_components'
  5. jasmine:
  6. src: 'src/*.js'
  7. options:
  8. vendor: [
  9. '<%= bower_path %>/jquery/dist/jquery.min.js',
  10. '<%= bower_path %>/jasmine-jquery/lib/jasmine-jquery.js'
  11. ]
  12. specs: 'spec/javascripts/*.js'
  13. # keepRunner: true
  14. uglify:
  15. options:
  16. banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
  17. build:
  18. files:
  19. 'dist/<%= pkg.name %>.min.js': ['src/<%= pkg.name %>.js']
  20. coffee:
  21. withMaps:
  22. options:
  23. bare: true
  24. sourceMap: true
  25. files:
  26. 'src/<%= pkg.name %>.js': 'src/<%= pkg.name %>.coffee'
  27. withoutMaps:
  28. options:
  29. bare: true
  30. sourceMap: false
  31. files:
  32. 'dist/<%= pkg.name %>.js': 'src/<%= pkg.name %>.coffee'
  33. watch:
  34. scripts:
  35. files: ['src/*.coffee']
  36. tasks: ['coffee', 'umd']
  37. umd:
  38. options:
  39. template: 'umd'
  40. deps:
  41. 'default': ['$']
  42. amd: ['jquery']
  43. cjs: ['jquery']
  44. global:
  45. items: ['jQuery']
  46. prefix: ''
  47. src:
  48. src: 'src/<%= pkg.name %>.js'
  49. dist:
  50. src: 'dist/<%= pkg.name %>.js'
  51. 'json-replace':
  52. options:
  53. space: " ",
  54. replace:
  55. version: "<%= pkg.version %>"
  56. 'update-version':
  57. files:[{
  58. 'bower.json': 'bower.json',
  59. 'component.json': 'component.json'
  60. }]
  61. grunt.loadNpmTasks 'grunt-contrib-coffee'
  62. grunt.loadNpmTasks 'grunt-contrib-uglify'
  63. grunt.loadNpmTasks 'grunt-contrib-jasmine'
  64. grunt.loadNpmTasks 'grunt-json-replace'
  65. grunt.loadNpmTasks 'grunt-contrib-watch'
  66. grunt.loadNpmTasks 'grunt-umd'
  67. grunt.registerTask 'update-version', 'json-replace'
  68. grunt.registerTask 'default', ['coffee', 'umd', 'jasmine','update-version', 'uglify', 'watch']
  69. grunt.registerTask 'test', ['coffee', 'umd', 'jasmine']