gruntfile.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. module.exports = function(grunt) {
  2. grunt.initConfig({
  3. pkg: grunt.file.readJSON('package.json'),
  4. jshint: {
  5. files: ['gruntfile.js', 'lib/js/emojione.js']
  6. },
  7. jsonlint: {
  8. files: {
  9. src: ['emoji.json','emoji_strategy.json']
  10. }
  11. },
  12. // BUILD PNG SPRITES
  13. sprite:{
  14. pngsprites: {
  15. src: 'assets/png/*.png',
  16. dest: 'assets/sprites/emojione.sprites.png',
  17. destCss: 'assets/sprites/emojione.sprites.css',
  18. 'cssTemplate': 'assets/sprites/emojione.sprites.mustache',
  19. 'algorithm': 'binary-tree',
  20. 'cssVarMap': function (sprite) {
  21. sprite.name = 'emojione-' + sprite.name;
  22. },
  23. padding: 1
  24. }
  25. },
  26. // BUILD EMOJI ONE AWESOME CSS (SASS -> CSS)
  27. sass: {
  28. dist: {
  29. options: {
  30. 'sourcemap': 'none'
  31. },
  32. files: {
  33. 'assets/css/emojione-awesome.css': 'lib/emojione-awesome/emojione-awesome.scss'
  34. }
  35. }
  36. },
  37. // BUILD SVG SPRITES
  38. svgstore: {
  39. options: {
  40. prefix : 'emoji-', // symbol ID prefix
  41. svg: {
  42. viewBox : '0 0 64 64',
  43. xmlns: 'http://www.w3.org/2000/svg',
  44. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  45. }
  46. },
  47. default : {
  48. files: {
  49. 'assets/sprites/emojione.sprites.svg': ['assets/svg/*.svg']
  50. }
  51. }
  52. },
  53. uglify: {
  54. options: {
  55. // the banner is inserted at the top of the output
  56. banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
  57. },
  58. dist: {
  59. files: {
  60. 'lib/js/<%= pkg.name %>.min.js': ['lib/js/<%= pkg.name %>.js']
  61. }
  62. }
  63. },
  64. // OPTIMIZE PNGs
  65. imageoptim: {
  66. pngs: {
  67. src: ['assets/png', 'assets/png']
  68. },
  69. sprite: {
  70. src: ['assets/sprites', 'assets/sprites']
  71. }
  72. },
  73. // Minify Project CSS
  74. cssmin: {
  75. target: {
  76. files: {
  77. 'assets/css/emojione.min.css': ['assets/css/emojione.css'],
  78. 'assets/sprites/emojione.sprites.css': ['assets/sprites/emojione.sprites.css']
  79. }
  80. }
  81. },
  82. watch: {
  83. files: ['<%= jshint.files %>'],
  84. tasks: ['jshint']
  85. },
  86. // run QUnit tests
  87. qunit: {
  88. all: ['lib/js/tests/tests.html']
  89. }
  90. });
  91. grunt.loadNpmTasks('grunt-spritesmith');
  92. grunt.loadNpmTasks('grunt-contrib-sass');
  93. grunt.loadNpmTasks('grunt-svgstore');
  94. grunt.loadNpmTasks('grunt-contrib-uglify');
  95. grunt.loadNpmTasks('grunt-contrib-jshint');
  96. grunt.loadNpmTasks('grunt-jsonlint');
  97. grunt.loadNpmTasks('grunt-contrib-watch');
  98. grunt.loadNpmTasks('grunt-contrib-cssmin');
  99. grunt.loadNpmTasks('grunt-imageoptim');
  100. grunt.loadNpmTasks('grunt-contrib-qunit');
  101. //grunt.registerTask('default', ['jshint','jsonlint', 'sprite:pngsprites', 'sass', 'svgstore', 'uglify', 'cssmin', 'imageoptim']);
  102. grunt.registerTask('default', ['jshint','jsonlint', 'sass', 'svgstore', 'uglify', 'cssmin']);
  103. grunt.registerTask('travis', ['qunit']);
  104. };