0

Grunt を使用してサーバーを作成しようとすると、すぐにシャットダウンし、ブラウザーに移動してテストするための変更が行われません。

これは私の Grunt ファイル全体です。

module.exports = function (grunt) {
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-watch');

    grunt.initConfig({
        connect: {
            serve: {
                options: {
                    port: 8081,
                    base: '/',
                    hostname: '*',
                    debug: true
                }
            }
        }
    });
    grunt.registerTask('default', ['connect']);
}

実行すると、エラーなしで動作します。

C:\Users\Imray\my-sandbox>grunt
Running "connect:keepalive" (connect) task
Started connect web server on http://0.0.0.0:8000

Running "connect:serve" (connect) task
Started connect web server on http://0.0.0.0:8081
4

1 に答える 1

0

keepaliveこれ専用の設定があります:

grunt.initConfig({
        connect: {
            serve: {
                options: {
                    keepalive: true,
                    port: 8081,
                    base: '/',
                    hostname: '*',
                    debug: true
                }
            }
        }
    });
于 2015-03-09T14:42:08.863 に答える