Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.25 KB | None | 0 0
  1. Warning: root path must be a string Use --force to continue.
  2.  
  3. /* global module, conf */
  4. var modRewrite = require('connect-modrewrite');
  5. var mountFolder = function(connect, dir) {
  6. return connect.static(require('path').resolve(dir));
  7. };
  8. module.exports = function(grunt) {
  9.  
  10. grunt.initConfig({
  11. copy: {
  12. base: {
  13. files: [
  14. {src: "index.html", dest: "BUILD/index.html"},
  15. {expand: true, src: "app/**", dest: "BUILD/"},
  16. {expand: true, src: "assets/**", dest: "BUILD/"}
  17. ]
  18. }
  19. },
  20.  
  21. connect: {
  22. proxies: [
  23. {
  24. context: "/wwff",
  25. host: "localhost",
  26. port: "8080"
  27. }
  28. ],
  29.  
  30. /**
  31. * Task defines a server at 9000,
  32. * watching the BUILD directory
  33. */
  34. dev: {
  35. options: {
  36. port: "9000",
  37. hostname: '*',
  38. base: "BUILD",
  39. middleware: function(connect, options) {
  40. var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest;
  41.  
  42. return [
  43. // include the proxy first
  44. proxySnippet,
  45. modRewrite([
  46. '!\.html|\.js|\.swf|\.json|\.xml|\.css|\.png|\.jpg|\.gif|\.ico|\.aff|\.msi|\.zip|\.dic$ /index.html [L]'
  47. ]),
  48. // serve static files
  49. connect.static(options.base),
  50. // make empty directories browsable
  51. connect.directory(options.base)
  52. ];
  53. }
  54. }
  55. }
  56. },
  57.  
  58. /*
  59. * This task watches the application and asset directories and
  60. * deploys any changes to the dev server
  61. */
  62. watch: {
  63. static: {
  64. files: [ "app/**/*.js", "app/**/*.html"],
  65. tasks: ["build"]
  66. }
  67. },
  68.  
  69. clean: {
  70. build: ["BUILD/"],
  71. temp: ["tmp"]
  72. }
  73. });
  74.  
  75. grunt.loadNpmTasks('grunt-contrib-copy');
  76. grunt.loadNpmTasks('grunt-contrib-connect');
  77. grunt.loadNpmTasks('grunt-contrib-watch');
  78. grunt.loadNpmTasks('grunt-connect-proxy');
  79. grunt.loadNpmTasks('grunt-contrib-clean');
  80.  
  81. /*
  82. * Main BUILD Task
  83. */
  84. grunt.registerTask("build", "Copies app and asset files to the BUILD directory.", function() {
  85. grunt.task.run("copy:base");
  86. });
  87.  
  88. grunt.registerTask("server", "Stand up a node server for development.", function() {
  89. grunt.task.run(["build", "configureProxies:dev", "connect:dev", "watch"]);
  90. });
  91.  
  92. grunt.event.on('watch', function(action, filepath, target) {
  93. grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
  94. });
  95.  
  96. };
  97.  
  98. Verifying property connect.dev exists in config...OK
  99. File: [no files]
  100. Options: protocol="http", port="9000", hostname="*", base="BUILD", directory=null, keepalive=false, debug=false, livereload=false, open=false, useAvailablePort=false, onCreateServer=null, middleware=undefined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement