PageRenderTime 26ms CodeModel.GetById 32ms RepoModel.GetById 1ms app.codeStats 0ms

/grunt.js

https://bitbucket.org/kqdtran/latex2html5
JavaScript | 191 lines | 86 code | 29 blank | 76 comment | 0 complexity | fbdbad4d3d1861dd0660e5f90959babc 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 clean task ensures all files are removed from the dist/ directory so
  7. // that no files linger from previous builds.
  8. clean: ["dist/"],
  9. // The lint task will run the build configuration and the application
  10. // JavaScript through JSHint and report any errors. You can change the
  11. // options for this task, by reading this:
  12. // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md
  13. lint: {
  14. files: [
  15. "app/config.js", "app/modules/**/*.js"
  16. ]
  17. },
  18. // The jshint option for scripturl is set to lax, because the anchor
  19. // override inside main.js needs to test for them so as to not accidentally
  20. // route.
  21. jshint: {
  22. options: {
  23. scripturl: true,
  24. evil: true
  25. }
  26. },
  27. // The jst task compiles all application templates into JavaScript
  28. // functions with the underscore.js template function from 1.2.4. You can
  29. // change the namespace and the template options, by reading this:
  30. // https://github.com/gruntjs/grunt-contrib/blob/master/docs/jst.md
  31. //
  32. // The concat task depends on this file to exist, so if you decide to
  33. // remove this, ensure concat is updated accordingly.
  34. jst: {
  35. "dist/debug/templates.js": [
  36. "app/modules/**/*.html"
  37. ]
  38. },
  39. // The handlebars task compiles all application templates into JavaScript
  40. // functions using Handlebars templating engine.
  41. //
  42. // Since this task defaults to writing to the same file as the jst task,
  43. // edit the debug task replacing jst with handlebars.
  44. //
  45. // The concat task depends on this file to exist, so if you decide to
  46. // remove this, ensure concat is updated accordingly.
  47. handlebars: {
  48. "dist/debug/templates.js": ["app/templates/**/*.html"]
  49. },
  50. // The concatenate task is used here to merge the almond require/define
  51. // shim and the templates into the application code. It's named
  52. // dist/debug/require.js, because we want to only load one script file in
  53. // index.html.
  54. concat: {
  55. dist: {
  56. src: [
  57. // "app/assets/js/libs/almond.js",
  58. "app/assets/js/libs/require.js",
  59. // "dist/debug/templates.js",
  60. "dist/debug/require.js"
  61. ],
  62. dest: "dist/debug/require.js",
  63. separator: ";"
  64. }
  65. },
  66. // This task uses the MinCSS Node.js project to take all your CSS files in
  67. // order and concatenate them into a single CSS file named index.css. It
  68. // also minifies all the CSS as well. This is named index.css, because we
  69. // only want to load one stylesheet in index.html.
  70. mincss: {
  71. "dist/release/index.css": [
  72. "app/assets/css/bootstrap.css",
  73. "app/assets/css/bootstrap-offset.css",
  74. "app/assets/css/bootstrap-responsive.css",
  75. "app/assets/css/codemirror.css",
  76. "app/assets/css/mathapedia.css"
  77. ]
  78. },
  79. // Takes the built require.js file and minifies it for filesize benefits.
  80. min: {
  81. "dist/release/require.js": [
  82. "dist/debug/require.js"
  83. ]
  84. },
  85. // Running the server without specifying an action will run the defaults,
  86. // port: 8000 and host: 127.0.0.1. If you would like to change these
  87. // defaults, simply add in the properties `port` and `host` respectively.
  88. // Alternatively you can omit the port and host properties and the server
  89. // task will instead default to process.env.PORT or process.env.HOST.
  90. //
  91. // Changing the defaults might look something like this:
  92. //
  93. // server: {
  94. // host: "127.0.0.1", port: 9001
  95. // debug: { ... can set host and port here too ...
  96. // }
  97. //
  98. // To learn more about using the server task, please refer to the code
  99. // until documentation has been written.
  100. server: {
  101. // Ensure the favicon is mapped correctly.
  102. files: { "favicon.ico": "favicon.ico" },
  103. port: 9000,
  104. debug: {
  105. // Ensure the favicon is mapped correctly.
  106. files: { "favicon.ico": "favicon.ico" },
  107. port: 9000,
  108. // Map `server:debug` to `debug` folders.
  109. folders: {
  110. "app": "dist/debug",
  111. "app/assets/js/libs": "dist/debug"
  112. }
  113. },
  114. release: {
  115. // This makes it easier for deploying, by defaulting to any IP.
  116. host: "0.0.0.0",
  117. port: 9000,
  118. // Ensure the favicon is mapped correctly.
  119. files: { "favicon.ico": "favicon.ico" },
  120. // Map `server:release` to `release` folders.
  121. folders: {
  122. "app": "dist/release",
  123. "app/assets/js/libs": "dist/release",
  124. "app/assets/css": "dist/release"
  125. }
  126. }
  127. },
  128. // This task uses James Burke's excellent r.js AMD build tool. In the
  129. // future other builders may be contributed as drop-in alternatives.
  130. requirejs: {
  131. // Include the main configuration file.
  132. mainConfigFile: "app/config.js",
  133. // Output file.
  134. out: "dist/debug/require.js",
  135. // Root application module.
  136. name: "config",
  137. // Do not wrap everything in an IIFE.
  138. wrap: false
  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. });
  151. // The debug task will remove all contents inside the dist/ folder, lint
  152. // all your code, precompile all the underscore templates into
  153. // dist/debug/templates.js, compile all the application code into
  154. // dist/debug/require.js, and then concatenate the require/define shim
  155. // almond.js and dist/debug/templates.js into the require.js file.
  156. grunt.registerTask("debug", "clean lint jst requirejs concat");
  157. // The release task will run the debug tasks and then minify the
  158. // dist/debug/require.js file and CSS files.
  159. grunt.registerTask("release", "debug min mincss");
  160. grunt.registerTask("server", "use-npm-start-instead!"); // use npm start instead!
  161. grunt.loadTasks("tasks");
  162. };