0
点赞
收藏
分享

微信扫一扫

(48)Gulp路由

芒果六斤半 2022-01-22 阅读 15

一、Gulp路由介绍图

我们前面再demo案例中指定过路由,那么我们可能不太清楚路由的原理是什么?那么接下来呢,我们来详细说明一下。

二、Gulp路由详情解析

URL地址:http://localhost:3000指向dist目标目录

那么我们地址栏访问:http://localhost:3000/index.html,那么实际访问的是dist/index.html

访问http://localhost:3000/node_modules

未指定路由:那么访问的是:dist/node_modules

已指定路由:'/node_modules':'node_modules',访问的是项目目录下的node_modules目录。

通过如上图我们看到,再dist目录下,并没有node_modules目录,肯定是访问不到这个目录的,所以我们要指定路由,改成当前项目下的node_modules目录访问,就可以啦!

三、案例demo

需求:访问http://localhost:3000/aaa 指向项目目录下的hello.html

举报

相关推荐

0 条评论