Gruntfile.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*jshint node: true */
  2. module.exports = function (grunt) {
  3. 'use strict';
  4. grunt.loadNpmTasks('grunt-contrib-concat');
  5. grunt.loadNpmTasks('grunt-contrib-connect');
  6. grunt.loadNpmTasks('grunt-contrib-uglify');
  7. grunt.loadNpmTasks('grunt-contrib-watch');
  8. grunt.initConfig({
  9. pkg: grunt.file.readJSON('package.json'),
  10. concat: {
  11. dist: {
  12. src: [
  13. 'src/start.frag',
  14. 'src/main.js',
  15. 'src/completer.js',
  16. 'src/dropdown.js',
  17. 'src/strategy.js',
  18. 'src/adapter.js',
  19. 'src/textarea.js',
  20. 'src/ie_textarea.js',
  21. 'src/content_editable.js',
  22. 'src/ckeditor.js',
  23. 'src/vendor/textarea_caret.js',
  24. 'src/end.frag'
  25. ],
  26. dest: 'dist/jquery.textcomplete.js'
  27. }
  28. },
  29. uglify: {
  30. options: {
  31. banner:
  32. '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
  33. '<%= grunt.template.today("yyyy-mm-dd") %> */',
  34. sourceMap: 'dist/jquery.textcomplete.min.map'
  35. },
  36. all: {
  37. files: {
  38. 'dist/jquery.textcomplete.min.js': [
  39. 'dist/jquery.textcomplete.js'
  40. ]
  41. }
  42. }
  43. },
  44. connect: {
  45. server: {
  46. options: {
  47. port: 8000,
  48. base: '../'
  49. }
  50. }
  51. },
  52. watch: {
  53. all: {
  54. files: ['src/*.js'],
  55. tasks: ['concat', 'uglify']
  56. }
  57. }
  58. });
  59. grunt.registerTask('default', ['connect', 'watch']);
  60. grunt.registerTask('build', ['concat', 'uglify']);
  61. };