Yeoman use google application server

I am configuring Yeoman 1.0 beta to handle my js / css tasks. Everything works fine, if I run it grunt server, it starts a static server and connects a browser session to port 9000 (download function). js / css concat, minification also work.

Now there is a way that I can connect to the development server of the Google engine (instead of starting a static server). The server runs on port 8080 on the local host, and I want to grunt in order to reload the web page when the css / js files are viewed. These files will be served by the GAE server.

I see a section rolling your ownin the grunt-contrib-connect documentation , but not sure if this means an external server. As far as I can see, this is the relevant configuration from Gruntfile.js

connect: {
      livereload: {
        options: {
          port: 8080, //*** was 9001 originally ** 
          middleware: function (connect) {
            return [
              lrSnippet,
              mountFolder(connect, '.tmp'),
              mountFolder(connect, yeomanConfig.app)
            ];
          }
        }
      },

When I change the port number to 8080 and try to start, it is obvious that it gives an error.

Fatal error: port 8080 is already in use by another process.

therefore, I do not want to start a new server, but I connect through the already started GAE server.

Thank.

+5
source share
2 answers

GAE nodejs, .
* less/coffeescript, concat [, minify], , .
* grunt.js, .

, . https://github.com/cowboy/grunt/tree/master/tasks

grunt.js !

module.exports = function(grunt) {
    grunt.initConfig({
    ....
    });

    grunt.registerTask('appengine-update', 'Upload to App Engine.', function() {
        var spawn = require('child_process').spawn;
        var PIPE = {stdio: 'inherit'};
        var done = this.async();

        spawn('appcfg.py', ['update', 'build/task-manager-angular'], PIPE).on('exit', function(status) {
            done(status === 0);
        });
   });
   grunt.registerTask('clean', 'Clean the whole build directory.', function() {
        require('child_process').exec('rm -rdf build', this.async());
   });

   grunt.registerTask('run', 'Run app server.', function() {
       var spawn = require('child_process').spawn;
       var PIPE = {stdio: 'inherit'};
       var done = this.async();
       spawn('dev_appserver.py', ['.'], PIPE).on('exit', function(status) {
          done(status === 0);
       });
    });
});

//....
//Other settings
//....

grunt.loadTasks('tasks');
grunt.loadNpmTasks('grunt-coffeelint');
grunt.registerTask('build', 'coffee less concat');
grunt.registerTask('deploy', 'coffee less concat build appengine-update');
grunt.registerTask('default', 'coffee less');
};
+7

All Articles