Gruntfile.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. module.exports = function(grunt) {
  2. // Project configuration.
  3. grunt.initConfig({
  4. pkg: grunt.file.readJSON('package.json'),
  5. font: {
  6. icons: {
  7. src: ['app/public/fonts/svg-icons/*.svg'],
  8. destCss: 'app/public/styles/less/icons.less',
  9. destFonts: 'app/public/fonts/icons.woff',
  10. // Optional: Custom routing of font filepaths for CSS
  11. cssRouter: function (fontpath) {
  12. var pathArray = fontpath.split('/');
  13. var fileName = pathArray[pathArray.length - 1];
  14. return '/public/fonts/' + fileName;
  15. }
  16. }
  17. },
  18. less: {
  19. all: {
  20. files: {
  21. 'app/public/styles/main.css': [ 'app/public/styles/less/main.less' ],
  22. 'app/public/styles/index.css': [ 'app/public/styles/less/index.less' ],
  23. 'app/public/styles/launchTest.css': [ 'app/public/styles/less/launchTest.less' ],
  24. 'app/public/styles/results.css': [ 'app/public/styles/less/results.less' ]
  25. }
  26. }
  27. },
  28. jshint: {
  29. all: [
  30. '*.js',
  31. 'app/lib/*',
  32. 'app/nodeControllers/*.js',
  33. 'app/public/scripts/*.js',
  34. 'phantomas_custom/**/*.js'
  35. ]
  36. },
  37. clean: {
  38. icons: {
  39. src: ['tmp']
  40. },
  41. coverage: {
  42. src: ['coverage/']
  43. }
  44. },
  45. copy: {
  46. coverage: {
  47. src: ['test/**'],
  48. dest: 'coverage/'
  49. }
  50. },
  51. blanket: {
  52. coverage: {
  53. src: ['app/'],
  54. dest: 'coverage/app/'
  55. }
  56. },
  57. mochaTest: {
  58. test: {
  59. options: {
  60. reporter: 'spec',
  61. },
  62. src: ['coverage/test/server/*.js']
  63. },
  64. coverage: {
  65. options: {
  66. reporter: 'html-cov',
  67. // use the quiet flag to suppress the mocha console output
  68. quiet: true,
  69. // specify a destination file to capture the mocha
  70. // output (the quiet option does not suppress this)
  71. captureFile: 'coverage/coverage.html'
  72. },
  73. src: ['coverage/test/server/*.js']
  74. }
  75. }
  76. });
  77. require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  78. grunt.registerTask('icons', [
  79. 'font:icons',
  80. 'less',
  81. 'clean:icons'
  82. ]);
  83. grunt.registerTask('build', [
  84. 'jshint',
  85. 'less'
  86. ]);
  87. grunt.registerTask('hint', [
  88. 'jshint'
  89. ]);
  90. grunt.registerTask('test', [
  91. 'clean:coverage',
  92. 'blanket',
  93. 'copy:coverage',
  94. 'mochaTest'
  95. ]);
  96. };