Note that there are some explanatory texts on larger screens.

plurals
  1. POGrunt livereload with node.js application
    primarykey
    data
    text
    <p>I have written an application in Node.js (with Express &amp; socket.io) and <strong>I would like to use Grunt to compile my client-side stuff with livereload while developing and being connected to Node.js application. How can I do this?</strong> (Preferably without running Node.js app in another port and client in another port, because of pathing and cross-domain issues)</p> <p>I installed also Yeoman and it's using out of the box grunt-contrib-livereload package, but from what I understood it's using Node.js Connect server for serving client-side files, thus being separated from my Node.js application..</p> <p>Example from Gruntfile.js generated by Yeoman:</p> <pre class="lang-js prettyprint-override"><code>var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; var mountFolder = function (connect, dir) { return connect.static(require('path').resolve(dir)); }; // ... cut some parts grunt.initConfig({ watch: { livereload: { files: [ '&lt;%= yeoman.app %&gt;/*/*.html', '{.tmp,&lt;%= yeoman.app %&gt;}/styles/*.css', '{.tmp,&lt;%= yeoman.app %&gt;}/scripts/*.js', '&lt;%= yeoman.app %&gt;/images/*.{png,jpg,jpeg}' ], tasks: ['livereload'] } // ..cut some parts }, connect: { livereload: { options: { port: 9000, middleware: function (connect) { return [ lrSnippet, mountFolder(connect, '.tmp'), mountFolder(connect, 'app') ]; } } } } // ..cut some parts }); grunt.registerTask('server', [ 'clean:server', 'coffee:dist', 'compass:server', 'livereload-start', 'connect:livereload', 'open', 'watch' ]); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload