A simple "mots mélés" game
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Gruntfile.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. module.exports = function(grunt) {
  2. // Project configuration.
  3. grunt.initConfig({
  4. pkg: grunt.file.readJSON('package.json'),
  5. uglify: {
  6. options: {
  7. banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
  8. },
  9. game: {
  10. files: {
  11. 'dist/js/<%= pkg.name %>.game.min.js': ['src/game/js/*.js']
  12. }
  13. },
  14. generator: {
  15. files: {
  16. 'dist/js/<%= pkg.name %>.generator.min.js': ['src/generator/js/*.js']
  17. }
  18. }
  19. },
  20. cssmin: {
  21. target: {
  22. files: {
  23. 'dist/css/<%= pkg.name %>.generator.css': 'src/generator/css/*.css',
  24. 'dist/css/<%= pkg.name %>.game.css': 'src/game/css/*.css'
  25. }
  26. }
  27. },
  28. jshint: {
  29. all: ['src/game/js/*.js', 'src/generator/js/*.js']
  30. },
  31. copy: {
  32. main: {
  33. files: [
  34. {expand: true, flatten: true, src: ['src/game/*.html', 'src/generator/*.html'], dest: 'dist/', filter: 'isFile'}
  35. ],
  36. options: {
  37. process: function (content, srcpath) {
  38. return content.replace(/(game.css|generator.css)/g, "motsmeles.$1");
  39. //return content.replace(/(\.\.\/\.\.\/vendor\/fabric\.1\.4\.0\.min\.js)/g,"js/fabric.1.4.0.min.js");
  40. }
  41. }
  42. },
  43. dev: {
  44. files: [
  45. {expand: true, flatten: true, src: ['src/game/*.html', 'src/generator/*.html'], dest: 'dist/', filter: 'isFile'},
  46. {expand: true, cwd: 'src/game/css/', src: '*.css', dest: 'dist/css/', filter: 'isFile'},
  47. {expand: true, cwd: 'src/generator/css/', src: '*.css', dest: 'dist/css/', filter: 'isFile'},
  48. ]
  49. },
  50. vendor: {
  51. files: [{expand: true, cwd: 'vendor/', src: '*.min.js', dest: 'dist/js/', filter: 'isFile'}]
  52. }
  53. },
  54. concat: {
  55. game: {
  56. src: ['src/game/js/*.js'],
  57. dest: 'dist/js/<%= pkg.name %>.game.min.js'
  58. },
  59. generator: {
  60. src: ['src/generator/js/*.js'],
  61. dest: 'dist/js/<%= pkg.name %>.generator.min.js'
  62. }
  63. },
  64. clean: {
  65. dist: ['dist'],
  66. force: true
  67. }
  68. });
  69. grunt.loadNpmTasks('grunt-contrib-clean');
  70. grunt.loadNpmTasks('grunt-contrib-uglify');
  71. grunt.loadNpmTasks('grunt-contrib-jshint');
  72. grunt.loadNpmTasks('grunt-contrib-cssmin');
  73. grunt.loadNpmTasks('grunt-contrib-copy');
  74. grunt.loadNpmTasks('grunt-contrib-concat');
  75. grunt.registerTask('default', ['clean:dist', 'jshint', 'uglify', 'cssmin', 'copy:main', 'copy:vendor']);
  76. grunt.registerTask('dev', ['clean:dist', 'jshint', 'concat', 'copy:dev', 'copy:vendor']);
  77. };