Gruntfile.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. 'use strict';
  2. module.exports = function(grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. // Metadata.
  6. pkg: grunt.file.readJSON('bootstrap-table.jquery.json'),
  7. banner: '/*\n' +
  8. '* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
  9. '<%= pkg.homepage ? "* " + pkg.homepage : "" %>\n' +
  10. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
  11. '* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n' +
  12. '*/\n',
  13. // Task configuration.
  14. clean: ['dist', 'docs/dist'],
  15. uglify: {
  16. options: {
  17. banner: '<%= banner %>'
  18. },
  19. my_target: {
  20. files: {
  21. 'dist/<%= pkg.name %>.min.js': ['src/<%=pkg.name %>.js']
  22. }
  23. },
  24. locale_target: {
  25. files: [{
  26. expand: true,
  27. cwd: 'src/locale',
  28. src: '**/*.js',
  29. dest: 'dist/locale',
  30. ext: '.min.js' // replace .js to .min.js
  31. }]
  32. },
  33. extensions_target: {
  34. files: [{
  35. expand: true,
  36. cwd: 'src/extensions',
  37. src: '**/*.js',
  38. dest: 'dist/extensions',
  39. ext: '.min.js' // replace .js to .min.js
  40. }]
  41. }
  42. },
  43. cssmin: {
  44. add_banner: {
  45. options: {
  46. banner: '<%= banner %>'
  47. },
  48. files: {
  49. 'dist/<%= pkg.name %>.min.css': ['src/<%=pkg.name %>.css']
  50. }
  51. }
  52. },
  53. copy: {
  54. files: {
  55. cwd: 'dist', // set working folder / root to copy
  56. src: '**/*', // copy all files and subfolders
  57. dest: 'docs/dist', // destination folder
  58. expand: true // required when using cwd
  59. }
  60. }
  61. });
  62. grunt.loadNpmTasks('grunt-contrib-clean');
  63. grunt.loadNpmTasks('grunt-contrib-uglify');
  64. grunt.loadNpmTasks('grunt-contrib-cssmin');
  65. grunt.loadNpmTasks('grunt-contrib-copy');
  66. grunt.registerTask('default', ['clean', 'uglify', 'cssmin', 'copy']);
  67. };