Pergunta

Aqui está o meu Gruntfile.js.

module.exports = function(grunt) {

  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  grunt.initConfig({
    dirs: {
      js: ['app/js/**/*.js', '!app/js/libs/**/*.js'],
      jshint: ['Gruntfile.js','app/js/**/*.js','!app/js/libs/**/*.js'],
      html: ['app/index.html'],
      css: ['app/styles/**/*.css'],
      less: ['app/styles/**/*.less'],
      tests: ['test/**/*.js']
    },
    hbs: {
      templateExtension : 'hbs'
    },
    connect:{
      development: {
        port: 9000,
        base: 'app',
        keepalive: true,
        livereload: true
      }
    }
  });

  grunt.registerTask('server', ['less', 'connect', 'watch', 'open:dev']);
};

Quando inicio o servidor, ele é executado na porta 8000.Pelo que entendi, estou especificando a porta no connect:developement:port propriedade.O que o faria rodar na porta 8000?enter image description here

Foi útil?

Solução

tente alterar o postfix de conexão para desenvolvimento:

grunt.registerTask('server', ['less', 'connect:development', 'watch', 'open:dev']);

talvez seja necessário especificar as opções também:

connect: {
    development: {
        options: {
            port: 9000,
            base: 'app',
            keepalive: true,
            livereload: true
        }
    }
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top