PageRenderTime 54ms CodeModel.GetById 30ms RepoModel.GetById 1ms app.codeStats 0ms

/grunt.js

https://bitbucket.org/kra3/client_kra3.in
JavaScript | 238 lines | 89 code | 36 blank | 113 comment | 0 complexity | f8dafa423f748acc0bdebd4a72712780 MD5 | raw file
  1. // This is the main application configuration file. It is a Grunt
  2. // configuration file, which you can learn more about here:
  3. // https://github.com/cowboy/grunt/blob/master/docs/configuring.md
  4. module.exports = function(grunt) {
  5. grunt.initConfig({
  6. // The lint task will run the build configuration and the application
  7. // JavaScript through JSHint and report any errors. You can change the
  8. // options for this task, by reading this:
  9. // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md
  10. lint: {
  11. files: [
  12. "build/config.js", "app/**/*.js"
  13. ]
  14. },
  15. // The jshint option for scripturl is set to lax, because the anchor
  16. // override inside main.js needs to test for them so as to not accidentally
  17. // route.
  18. jshint: {
  19. options: {
  20. scripturl: true
  21. }
  22. },
  23. // The jst task compiles all application templates into JavaScript
  24. // functions with the underscore.js template function from 1.2.4. You can
  25. // change the namespace and the template options, by reading this:
  26. // https://github.com/gruntjs/grunt-contrib/blob/master/docs/jst.md
  27. //
  28. // The concat task depends on this file to exist, so if you decide to
  29. // remove this, ensure concat is updated accordingly.
  30. jst: {
  31. "dist/debug/templates.js": [
  32. "app/templates/**/*.html"
  33. ]
  34. },
  35. // This task simplifies working with CSS inside Backbone Boilerplate
  36. // projects. Instead of manually specifying your stylesheets inside the
  37. // configuration, you can use `@imports` and this task will concatenate
  38. // only those paths.
  39. styles: {
  40. // Out the concatenated contents of the following styles into the below
  41. // development file path.
  42. "dist/debug/index.css": {
  43. // Point this to where your `index.css` file is location.
  44. src: "app/styles/index.css",
  45. // The relative path to use for the @imports.
  46. paths: ["app/styles"],
  47. // Point to where styles live.
  48. prefix: "app/styles/",
  49. // Additional production-only stylesheets here.
  50. additional: []
  51. }
  52. },
  53. // This task uses James Burke's excellent r.js AMD build tool. In the
  54. // future other builders may be contributed as drop-in alternatives.
  55. requirejs: {
  56. // Include the main configuration file.
  57. mainConfigFile: "app/config.js",
  58. // Also include the JamJS configuration file.
  59. jamConfig: "/vendor/jam/require.config.js",
  60. // Output file.
  61. out: "dist/debug/require.js",
  62. // Root application module.
  63. name: "config",
  64. // Do not wrap everything in an IIFE.
  65. wrap: false
  66. },
  67. // The concatenate task is used here to merge the almond require/define
  68. // shim and the templates into the application code. It's named
  69. // dist/debug/require.js, because we want to only load one script file in
  70. // index.html.
  71. concat: {
  72. dist: {
  73. src: [
  74. "vendor/js/libs/almond.js",
  75. "dist/debug/templates.js",
  76. "dist/debug/require.js"
  77. ],
  78. dest: "dist/debug/require.js",
  79. separator: ";"
  80. }
  81. },
  82. // This task uses the MinCSS Node.js project to take all your CSS files in
  83. // order and concatenate them into a single CSS file named index.css. It
  84. // also minifies all the CSS as well. This is named index.css, because we
  85. // only want to load one stylesheet in index.html.
  86. mincss: {
  87. "dist/release/index.css": [
  88. "dist/debug/index.css"
  89. ]
  90. },
  91. // Takes the built require.js file and minifies it for filesize benefits.
  92. min: {
  93. "dist/release/require.js": [
  94. "dist/debug/require.js"
  95. ]
  96. },
  97. // Running the server without specifying an action will run the defaults,
  98. // port: 8000 and host: 127.0.0.1. If you would like to change these
  99. // defaults, simply add in the properties `port` and `host` respectively.
  100. // Alternatively you can omit the port and host properties and the server
  101. // task will instead default to process.env.PORT or process.env.HOST.
  102. //
  103. // Changing the defaults might look something like this:
  104. //
  105. // server: {
  106. // host: "127.0.0.1", port: 9001
  107. // debug: { ... can set host and port here too ...
  108. // }
  109. //
  110. // To learn more about using the server task, please refer to the code
  111. // until documentation has been written.
  112. server: {
  113. // Ensure the favicon is mapped correctly.
  114. files: { "favicon.ico": "favicon.ico" },
  115. // For styles.
  116. prefix: "app/styles/",
  117. debug: {
  118. // Ensure the favicon is mapped correctly.
  119. files: "<config:server.files>",
  120. // Map `server:debug` to `debug` folders.
  121. folders: {
  122. "app": "dist/debug",
  123. "vendor/js/libs": "dist/debug",
  124. "app/styles": "dist/debug"
  125. }
  126. },
  127. release: {
  128. // This makes it easier for deploying, by defaulting to any IP.
  129. host: "0.0.0.0",
  130. // Ensure the favicon is mapped correctly.
  131. files: "<config:server.files>",
  132. // Map `server:release` to `release` folders.
  133. folders: {
  134. "app": "dist/release",
  135. "vendor/js/libs": "dist/release",
  136. "app/styles": "dist/release"
  137. }
  138. }
  139. },
  140. // The headless QUnit testing environment is provided for "free" by Grunt.
  141. // Simply point the configuration to your test directory.
  142. qunit: {
  143. all: ["test/qunit/*.html"]
  144. },
  145. // The headless Jasmine testing is provided by grunt-jasmine-task. Simply
  146. // point the configuration to your test directory.
  147. jasmine: {
  148. all: ["test/jasmine/*.html"]
  149. },
  150. // The watch task can be used to monitor the filesystem and execute
  151. // specific tasks when files are modified. By default, the watch task is
  152. // available to compile CSS if you are unable to use the runtime compiler
  153. // (use if you have a custom server, PhoneGap, Adobe Air, etc.)
  154. watch: {
  155. files: ["grunt.js", "vendor/**/*", "app/**/*"],
  156. tasks: "styles"
  157. },
  158. // The clean task ensures all files are removed from the dist/ directory so
  159. // that no files linger from previous builds.
  160. clean: ["dist/"],
  161. // If you want to generate targeted `index.html` builds into the `dist/`
  162. // folders, uncomment the following configuration block and use the
  163. // conditionals inside `index.html`.
  164. //targethtml: {
  165. // debug: {
  166. // src: "index.html",
  167. // dest: "dist/debug/index.html"
  168. // },
  169. //
  170. // release: {
  171. // src: "index.html",
  172. // dest: "dist/release/index.html"
  173. // }
  174. //},
  175. // This task will copy assets into your build directory,
  176. // automatically. This makes an entirely encapsulated build into
  177. // each directory.
  178. //copy: {
  179. // debug: {
  180. // files: {
  181. // "dist/debug/app/": "app/**",
  182. // "dist/debug/vendor/": "vendor/**"
  183. // }
  184. // },
  185. // release: {
  186. // files: {
  187. // "dist/release/app/": "app/**",
  188. // "dist/release/vendor/": "vendor/**"
  189. // }
  190. // }
  191. //}
  192. });
  193. // The debug task will remove all contents inside the dist/ folder, lint
  194. // all your code, precompile all the underscore templates into
  195. // dist/debug/templates.js, compile all the application code into
  196. // dist/debug/require.js, and then concatenate the require/define shim
  197. // almond.js and dist/debug/templates.js into the require.js file.
  198. grunt.registerTask("debug", "clean lint jst requirejs concat styles");
  199. // The release task will run the debug tasks and then minify the
  200. // dist/debug/require.js file and CSS files.
  201. grunt.registerTask("release", "debug min mincss");
  202. };