grunt-serve更改默认路径 [英] grunt-serve change default path

查看:128
本文介绍了grunt-serve更改默认路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用grunt-serve并尝试更改默认路径,在我的initConfig中使用以下


I am using grunt-serve and trying to change the default path, in my initConfig I use the following

serve: {
    path: '/mypath'
},

然后当我访问localhost:9000时,我仍然看到gruntfile.js根文件夹的文件和文件夹。
我想将根路径更改为/ mypath,并创建相关的所有链接。另外,当我访问有index.html文件的文件夹时,我想让服务器显示它。

Then when I visit localhost:9000 I still seeing the files and folders of the gruntfile.js root folder. I want to change the root path to /mypath and make all links relative to that. Also when I visit folder that has an index.html file I want the server to display it.

推荐答案

您需要设置 options.serve.path ,而不是 path

grunt.initConfig({
    serve: {
        options: {
            serve: {
                path: '/mypath'
            }
        }
    },
});

这篇关于grunt-serve更改默认路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆