PageRenderTime 47ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/grunt.js

https://github.com/bastikohn/FAU-Fragenkatalog
JavaScript | 148 lines | 66 code | 23 blank | 59 comment | 1 complexity | 1838a7d52afd8fa7ca09474604c0fcc3 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. //
  5. module.exports = function(grunt) {
  6. grunt.initConfig({
  7. // The clean task ensures all files are removed from the dist/ directory so
  8. // that no files linger from previous builds.
  9. clean: ["dist/"],
  10. // The lint task will run the build configuration and the application
  11. // JavaScript through JSHint and report any errors. You can change the
  12. // options for this task, by reading this:
  13. // https://github.com/cowboy/grunt/blob/master/docs/task_lint.md
  14. lint: {
  15. files: [
  16. "build/config.js", "app/**/*.js"
  17. ]
  18. },
  19. // The jshint option for scripturl is set to lax, because the anchor
  20. // override inside main.js needs to test for them so as to not accidentally
  21. // route.
  22. jshint: {
  23. options: {
  24. scripturl: 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/tbranyen/build-tasks/tree/master/jst
  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/templates/**/*.html"
  37. ]
  38. },
  39. // The concatenate task is used here to merge the almond require/define
  40. // shim and the templates into the application code. It's named
  41. // dist/debug/require.js, because we want to only load one script file in
  42. // index.html.
  43. concat: {
  44. "dist/debug/require.js": [
  45. "assets/js/libs/almond.js",
  46. "dist/debug/templates.js",
  47. "dist/debug/require.js"
  48. ]
  49. },
  50. // This task uses the MinCSS Node.js project to take all your CSS files in
  51. // order and concatenate them into a single CSS file named index.css. It
  52. // also minifies all the CSS as well. This is named index.css, because we
  53. // only want to load one stylesheet in index.html.
  54. mincss: {
  55. "dist/release/index.css": [
  56. "assets/css/style.css"
  57. ]
  58. },
  59. // Takes the built require.js file and minifies it for filesize benefits.
  60. min: {
  61. "dist/release/require.js": [
  62. "dist/debug/require.js"
  63. ]
  64. },
  65. // Running the server without specifying an action will run the defaults,
  66. // port: 8080 and host: 127.0.0.1. If you would like to change these
  67. // defaults, simply add in the properties `port` and `host` respectively.
  68. //
  69. // Changing the defaults might look something like this:
  70. //
  71. // server: {
  72. // host: "127.0.0.1", port: 9001
  73. // debug: { ... can set host and port here too ...
  74. // }
  75. //
  76. // To learn more about using the server task, please refer to the code
  77. // until documentation has been written.
  78. server: {
  79. files: { "favicon.ico": "favicon.ico" },
  80. debug: {
  81. files: { "favicon.ico": "favicon.ico" },
  82. folders: {
  83. "app": "dist/debug",
  84. "assets/js/libs": "dist/debug"
  85. }
  86. },
  87. release: {
  88. // These two options make it easier for deploying, by using whatever
  89. // PORT is available in the environment and defaulting to any IP.
  90. host: "0.0.0.0",
  91. port: process.env.PORT || 8000,
  92. files: { "favicon.ico": "favicon.ico" },
  93. folders: {
  94. "app": "dist/release",
  95. "assets/js/libs": "dist/release",
  96. "assets/css": "dist/release"
  97. }
  98. }
  99. },
  100. // This task uses James Burke's excellent r.js AMD build tool. In the
  101. // future other builders may be contributed as drop-in alternatives.
  102. requirejs: {
  103. // Include the main configuration file
  104. mainConfigFile: "app/config.js",
  105. // Output file
  106. out: "dist/debug/require.js",
  107. // Root application module
  108. name: "config",
  109. // Do not wrap everything in an IIFE
  110. wrap: false
  111. }
  112. });
  113. // The default task will remove all contents inside the dist/ folder, lint
  114. // all your code, precompile all the underscore templates into
  115. // dist/debug/templates.js, compile all the application code into
  116. // dist/debug/require.js, and then concatenate the require/define shim
  117. // almond.js and dist/debug/templates.js into the require.js file.
  118. grunt.registerTask("default", "clean lint jst requirejs concat");
  119. // The debug task is simply an alias to default to remain consistent with
  120. // debug/release.
  121. grunt.registerTask("debug", "default");
  122. // The release task will run the debug tasks and then minify the
  123. // dist/debug/require.js file and CSS files.
  124. grunt.registerTask("release", "default min mincss");
  125. };