Gruntfile.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. module.exports = function(grunt) {
  2. // Load all grunt tasks.
  3. require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  4. // Project configuration.
  5. grunt.initConfig({
  6. nodeunit: {
  7. all: ['test/*_test.js']
  8. },
  9. sass: {
  10. options: {
  11. style: 'expanded'
  12. },
  13. dist: {
  14. files: {
  15. '_jekyll/css/select2-bootstrap.css': 'lib/build.scss',
  16. 'docs/css/select2-bootstrap.css': 'lib/build.scss',
  17. 'select2-bootstrap.css': 'lib/build.scss'
  18. }
  19. },
  20. test: {
  21. files: {
  22. 'tmp/select2-bootstrap.css': 'lib/build.scss'
  23. }
  24. }
  25. },
  26. cssmin: {
  27. target: {
  28. files: {
  29. 'select2-bootstrap.min.css': 'select2-bootstrap.css'
  30. }
  31. }
  32. },
  33. jshint: {
  34. all: ['Gruntfile.js', '*.json']
  35. },
  36. bump: {
  37. options: {
  38. files: [
  39. 'package.json',
  40. 'bower.json',
  41. 'lib/select2-bootstrap/version.rb'
  42. ],
  43. push: false,
  44. createTag: false
  45. }
  46. },
  47. copy: {
  48. main: {
  49. files: [
  50. {
  51. src: 'bower_components/bootstrap/dist/css/bootstrap.min.css',
  52. dest: '_jekyll/css/bootstrap.min.css',
  53. expand: false
  54. },
  55. {
  56. src: 'bower_components/bootstrap/dist/js/bootstrap.min.js',
  57. dest: '_jekyll/js/bootstrap.min.js',
  58. expand: false
  59. },
  60. {
  61. src: 'bower_components/respond/dest/respond.min.js',
  62. dest: '_jekyll/js/respond.min.js',
  63. expand: false
  64. },
  65. {
  66. cwd: 'bower_components/bootstrap/dist/fonts',
  67. src: ['**/*'],
  68. dest: '_jekyll/fonts',
  69. expand: true
  70. }
  71. ]
  72. }
  73. },
  74. shell: {
  75. jekyllBuild: {
  76. command: 'jekyll build -s _jekyll -d docs'
  77. },
  78. jekyllServe: {
  79. command: 'jekyll serve -w -s _jekyll -d docs'
  80. }
  81. },
  82. 'gh-pages': {
  83. options: {
  84. base: 'docs',
  85. message: 'Update gh-pages.'
  86. },
  87. src: ['**/*']
  88. },
  89. watch: {
  90. files: 'lib/select2-bootstrap.scss',
  91. tasks: ['sass'],
  92. options: {
  93. livereload: true
  94. }
  95. }
  96. });
  97. // Default tasks.
  98. grunt.registerTask('build', ['sass', 'cssmin', 'copy', 'shell:jekyllBuild']);
  99. grunt.registerTask('serve', ['shell:jekyllServe']);
  100. };