Gruntfile.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. pkg: grunt.file.readJSON('package.json'),
  4. buildDir: 'dist',
  5. banner: [
  6. '/**',
  7. ' * BootstrapValidate v<%= pkg.version %> (<%= pkg.homepage %>)',
  8. ' *',
  9. ' * A jQuery plugin to validate form fields. Use with Bootstrap 3',
  10. ' *',
  11. ' * @author Nguyen Huu Phuoc <phuoc@huuphuoc.me>',
  12. ' * @copyright (c) 2013 Nguyen Huu Phuoc',
  13. ' * @license MIT',
  14. ' */\n\n'
  15. ].join('\n'),
  16. concat: {
  17. options: {
  18. separator: ';',
  19. stripBanners: true,
  20. banner: '<%= banner %>'
  21. },
  22. dist: {
  23. src: ['src/js/bootstrapvalidate.js', 'src/js/validator/*.js'],
  24. dest: '<%= buildDir %>/js/bootstrapvalidate.js'
  25. }
  26. },
  27. uglify: {
  28. options: {
  29. banner: '<%= banner %>'
  30. },
  31. build: {
  32. src: ['<%= buildDir %>/js/bootstrapvalidate.js'],
  33. dest: '<%= buildDir %>/js/bootstrapvalidate.min.js'
  34. }
  35. },
  36. watch: {
  37. scripts: {
  38. files: ['src/js/**'],
  39. tasks: ['build'],
  40. options: {
  41. spawn: false
  42. }
  43. }
  44. }
  45. });
  46. grunt.registerTask('default', 'build');
  47. grunt.registerTask('build', ['concat', 'uglify']);
  48. grunt.loadNpmTasks('grunt-contrib-concat');
  49. grunt.loadNpmTasks('grunt-contrib-uglify');
  50. grunt.loadNpmTasks('grunt-contrib-watch');
  51. };