Gruntfile.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. module.exports = function (grunt) {
  2. var sources_native = [
  3. 'src/intro.js',
  4. 'src/template.js',
  5. 'src/config.js',
  6. 'src/cache.js',
  7. 'src/render.js',
  8. 'src/renderFile.js',
  9. 'src/get.js',
  10. 'src/utils.js',
  11. 'src/helper.js',
  12. 'src/onerror.js',
  13. 'src/compile.js',
  14. //<<<< 'src/syntax.js',
  15. 'src/outro.js'
  16. ];
  17. var sources_simple = Array.apply(null, sources_native);
  18. sources_simple.splice(sources_native.length - 1, 0, 'src/syntax.js');
  19. grunt.initConfig({
  20. pkg: grunt.file.readJSON('package.json'),
  21. meta: {
  22. banner: '/*!<%= pkg.name %> - Template Engine | <%= pkg.homepage %>*/\n'
  23. },
  24. concat: {
  25. options: {
  26. separator: ''
  27. },
  28. 'native': {
  29. src: sources_native,
  30. dest: 'dist/template-native-debug.js'
  31. },
  32. simple: {
  33. src: sources_simple,
  34. dest: 'dist/template-debug.js'
  35. }
  36. },
  37. uglify: {
  38. options: {
  39. banner: '<%= meta.banner %>'
  40. },
  41. 'native': {
  42. src: '<%= concat.native.dest %>',
  43. dest: 'dist/template-native.js'
  44. },
  45. simple: {
  46. src: '<%= concat.simple.dest %>',
  47. dest: 'dist/template.js'
  48. }
  49. },
  50. qunit: {
  51. files: ['test/**/*.html']
  52. },
  53. jshint: {
  54. files: [
  55. 'dist/template-native.js',
  56. 'dist/template.js'
  57. ],
  58. options: {
  59. curly: true,
  60. eqeqeq: true,
  61. immed: true,
  62. latedef: true,
  63. newcap: true,
  64. noarg: true,
  65. sub: true,
  66. undef: true,
  67. boss: true,
  68. eqnull: true,
  69. browser: true
  70. },
  71. globals: {
  72. console: true,
  73. define: true,
  74. global: true,
  75. module: true
  76. }
  77. },
  78. watch: {
  79. files: '<config:lint.files>',
  80. tasks: 'lint qunit'
  81. }
  82. });
  83. grunt.loadNpmTasks('grunt-contrib-uglify');
  84. grunt.loadNpmTasks('grunt-contrib-jshint');
  85. //grunt.loadNpmTasks('grunt-contrib-qunit');
  86. //grunt.loadNpmTasks('grunt-contrib-watch');
  87. grunt.loadNpmTasks('grunt-contrib-concat');
  88. grunt.registerTask('default', ['concat', /*'jshint',*/ 'uglify']);
  89. };