Gruntfile.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. var path = require("path");
  2. module.exports = function (grunt) {
  3. grunt.loadNpmTasks("grunt-contrib-clean");
  4. grunt.loadNpmTasks("grunt-contrib-jshint");
  5. grunt.loadNpmTasks("grunt-contrib-cssmin");
  6. grunt.loadNpmTasks("grunt-contrib-concat");
  7. grunt.loadNpmTasks("grunt-mochaccino");
  8. grunt.loadNpmTasks("grunt-closure-compiler");
  9. grunt.loadNpmTasks("grunt-banner");
  10. grunt.loadNpmTasks('grunt-karma');
  11. grunt.loadNpmTasks('grunt-contrib-less');
  12. grunt.loadNpmTasks('grunt-contrib-watch');
  13. grunt.initConfig({
  14. pkg: grunt.file.readJSON('package.json'),
  15. clean: [ "build/cov" ],
  16. // see .jshintrc file for the options;
  17. // options are explained at http://www.jshint.com/docs/config/
  18. jshint: {
  19. options: {
  20. jshintrc: ".jshintrc"
  21. },
  22. core: [ "src/*.js" ],
  23. },
  24. karma: {
  25. unit: {
  26. configFile: 'karma.conf.js'
  27. }
  28. },
  29. concat: {
  30. afui:{
  31. files: {
  32. "build/appframework.ui.js": [
  33. "src/af.shim.js",
  34. "src/af.ui.js",
  35. "src/af.actionsheet.js",
  36. "src/af.grower.js",
  37. "src/af.touchEvents.js",
  38. "src/af.animateheader.js",
  39. "src/af.popup.js",
  40. "src/af.animation.js",
  41. "src/af.splashscreen.js",
  42. "src/af.drawer.js",
  43. "src/af.swipereveal.js",
  44. "src/af.desktopBrowsers.js",
  45. "src/af.toast.js"
  46. ]
  47. }
  48. },
  49. less: {
  50. files: {
  51. "build/af.ui.less":[
  52. "src/less/main.less",
  53. "src/less/anim2.less",
  54. "src/less/animation.less",
  55. "src/less/*.less"
  56. ]
  57. }
  58. },
  59. lessBase: {
  60. files: {
  61. "./build/af.ui.base.less": [
  62. "src/less/main.less",
  63. "src/less/anim2.less",
  64. "src/less/animation.less",
  65. "src/less/appframework.less",
  66. "src/less/af.actionsheet.less",
  67. "src/less/af.popup.less",
  68. "src/less/af.splashscreen.less",
  69. "src/less/af.swipereveal.less",
  70. "src/less/af.toast.less",
  71. "src/less/badges.less",
  72. "src/less/buttons.less",
  73. "src/less/forms.less",
  74. "src/less/grid.less",
  75. "src/less/lists.less",
  76. "src/less/splitview.less"
  77. ]
  78. }
  79. }
  80. },
  81. "closure-compiler": {
  82. "appframework-ui": {
  83. closurePath: "../closure/",
  84. js: ["build/appframework.ui.js"],
  85. jsOutputFile: "build/appframework.ui.min.js",
  86. options: {
  87. },
  88. maxBuffer: 500,
  89. noreport:true
  90. },
  91. },
  92. usebanner: {
  93. taskName: {
  94. options: {
  95. position: "top",
  96. banner: "/*! <%= pkg.name %> - v<%= pkg.version %> - "+
  97. "<%= grunt.template.today('yyyy-mm-dd') %> */\n",
  98. linebreak: true
  99. },
  100. files: {
  101. src: [ "build/*.js","build/*.js","build/css/*.css" ]
  102. }
  103. }
  104. },
  105. less: {
  106. development: {
  107. options: {
  108. paths: ["./src/less"],
  109. yuicompress: false
  110. },
  111. files: {
  112. "./build/af.ui.css": "./src/less/*.less"
  113. }
  114. },
  115. base: {
  116. options: {
  117. paths: ["./src/less"],
  118. yuicompress: false
  119. },
  120. files: {
  121. "./build/af.ui.base.css": [
  122. "src/less/main.less",
  123. "src/less/anim2.less",
  124. "src/less/animation.less",
  125. "src/less/appframework.less",
  126. "src/less/af.actionsheet.less",
  127. "src/less/af.popup.less",
  128. "src/less/af.splashscreen.less",
  129. "src/less/af.swipereveal.less",
  130. "src/less/af.toast.less",
  131. "src/less/badges.less",
  132. "src/less/buttons.less",
  133. "src/less/forms.less",
  134. "src/less/grid.less",
  135. "src/less/lists.less",
  136. "src/less/splitview.less"
  137. ]
  138. }
  139. }
  140. },
  141. watch: {
  142. files: "./src/less/*.less",
  143. tasks: ["less"]
  144. }
  145. });
  146. grunt.registerTask("default", [
  147. "jshint",
  148. "test",
  149. "clean",
  150. "closure-compiler",
  151. "usebanner",
  152. "watch"
  153. ]);
  154. grunt.registerTask("rebuild" , ["concat","closure-compiler","usebanner"]);
  155. grunt.registerTask("hint" , ["jshint"]);
  156. grunt.registerTask("test" , ["karma"]);
  157. };