How to use download from multiple servers on one page? (specifically with connecting and viewing Grunt.js)

I am trying to work with a liver, working on the same website, initiated by different servers, from different projects. I am using Grunt.js with grunt-contrib-connect and grunt-contrib-watch.

Here's an example:

  • ProjectA is currently running a download server on localhost: 33333
  • ProjectB is currently running download server on localhost: 44444
  • ProjectC is currently running a download server at localhost: 55555

Now let's say I'm running a web page on localhost: 9800, which should benefit from being loaded into the liver So in most cases where there is only one leafing process present, localhost has something like this: 9800 / index .html:

 
<body>
  ...
  <script type="text/javascript" charset="UTF-8" src="//localhost:35729/livereload.js"></script>
</body>

      

so with multiple vertically loaded servers, I thought I would have to include all boot related scripts:

 
<body>
...
  <script type="text/javascript" charset="UTF-8" src="//localhost:33333/livereload.js"></script>
  <script type="text/javascript" charset="UTF-8" src="//localhost:44444/livereload.js"></script>
  <script type="text/javascript" charset="UTF-8" src="//localhost:55555/livereload.js"></script>
</body>

      

which doesn't work. Only the first script causes it to load in the browser. In the grunt-contrib-watch docs, they have an example of starting different servers for different purposes of a watch task. How do you actually do this job?

Thanks for any help

Here's my task for testing:

 
  watch: {

    css: {
      files: ['www/**/*.css'],
      options: {
        livereload: 33333
      }
    },

    html: {
      files: ['www/**/*.html'],
      options: {
        livereload: 44444
      }
    },

    js: {
      files: ['www/**/*.js'],
      options: {
        livereload: 55555
      }
    },
...
}

      

+3


source to share


1 answer


This configuration may not work.

livereload.js instantiates the global LiveReload object ( livereload-js / src / startup.coffee ). And there is only one web socket available for the LiveReload object, so you cannot have 3 sockets.



I would like to have the same config as you, but today I didn't find any work for it

+2


source







All Articles