Gruntfile.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*global module */
  2. module.exports = function(grunt) {
  3. 'use strict';
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6. banner: '/*!\n * Peppermint touch slider\n * v. <%= pkg.version %> | <%= pkg.homepage %>\n * Copyright <%= pkg.author.name %> | <%= pkg.author.url %>\n *\n * Depends on Event Burrito (included) | https://github.com/wilddeer/Event-Burrito\n * MIT License\n */\n',
  7. bannerPure: '/*!\n * Peppermint touch slider\n * v. <%= pkg.version %> | <%= pkg.homepage %>\n * Copyright <%= pkg.author.name %> | <%= pkg.author.url %>\n *\n * Depends on Event Burrito | https://github.com/wilddeer/Event-Burrito\n * MIT License\n */\n',
  8. uglify: {
  9. options: {
  10. mangle: {
  11. except: ['Peppermint', '$', 'jQuery', 'EventBurrito']
  12. }
  13. },
  14. peppermint: {
  15. files: {
  16. 'temp/peppermint.min.js': ['src/peppermint.js']
  17. }
  18. },
  19. burrito: {
  20. files: {
  21. 'temp/eventburrito.min.js': ['src/burrito/eventburrito.js']
  22. }
  23. }
  24. },
  25. concat: {
  26. options: {
  27. banner: '<%= banner %>',
  28. separator: '\n'
  29. },
  30. full: {
  31. src: ['src/peppermint.js','src/burrito/eventburrito.js'],
  32. dest: 'dist/peppermint.js',
  33. },
  34. min: {
  35. src: ['temp/peppermint.min.js','temp/eventburrito.min.js'],
  36. dest: 'dist/peppermint.min.js',
  37. },
  38. pureFull: {
  39. options: {
  40. banner: '<%= bannerPure %>'
  41. },
  42. src: ['src/peppermint.js'],
  43. dest: 'dist/pure/peppermint.pure.js'
  44. },
  45. pureMin: {
  46. options: {
  47. banner: '<%= bannerPure %>'
  48. },
  49. src: ['temp/peppermint.min.js'],
  50. dest: 'dist/pure/peppermint.pure.min.js'
  51. },
  52. cssRequired: {
  53. options: {
  54. banner: '/* Peppermint minimal required styles */\n\n'
  55. },
  56. src: ['src/peppermint.required.css'],
  57. dest: 'dist/peppermint.required.css'
  58. },
  59. cssSuggested: {
  60. options: {
  61. banner: '/* Peppermint required styles + default appearance styles */\n\n',
  62. separator: '\n\n/* default appearance styles */\n'
  63. },
  64. src: ['src/peppermint.required.css', 'src/peppermint.appearance.css'],
  65. dest: 'dist/peppermint.suggested.css'
  66. }
  67. },
  68. bump: {
  69. options: {
  70. files: ['package.json', 'bower.json'],
  71. updateConfigs: ['pkg'],
  72. commit: true,
  73. commitMessage: 'tagging v. %VERSION%',
  74. commitFiles: ['.'],
  75. createTag: true,
  76. tagName: '%VERSION%',
  77. tagMessage: 'tagging v. %VERSION%',
  78. push: false
  79. }
  80. },
  81. shell: {
  82. push: {
  83. command: 'git push'
  84. },
  85. pushTags: {
  86. command: 'git push --tags'
  87. }
  88. },
  89. watch: {
  90. files: ['src/**/*.js', 'src/**/*.css', 'package.json'],
  91. tasks: ['build']
  92. },
  93. });
  94. // build
  95. grunt.loadNpmTasks('grunt-contrib-uglify');
  96. grunt.loadNpmTasks('grunt-contrib-concat');
  97. grunt.loadNpmTasks('grunt-contrib-watch');
  98. grunt.loadNpmTasks('grunt-bump');
  99. grunt.loadNpmTasks('grunt-shell');
  100. grunt.registerTask('build', ['uglify', 'concat']);
  101. grunt.registerTask('release', ['bump-only:patch', 'uglify', 'concat', 'bump-commit', 'shell:push', 'shell:pushTags']);
  102. grunt.registerTask('w', ['build', 'watch']);
  103. grunt.registerTask('default', 'build');
  104. };