fex-team / fis3

FIS3
http://fis.baidu.com
BSD 2-Clause "Simplified" License
2.79k stars 693 forks source link

uri的问题 #237

Open harvey-woo opened 9 years ago

harvey-woo commented 9 years ago
fis.match(/^\/views\/.+(\.(?:html))$/i, {
    release: '/views/test$1',
    uri: '/a/b'
});

例如这个样子的配置,uri没有写上文件后缀,但实际上会自动添加和原来文件一样的后缀,个人认为这个做法欠妥。 时间仓促,可能上述代码未必能运行,但是的确遇到如此情况 FIS2也有同样的问题,困扰已久

oxUnd commented 9 years ago
fis.match(/^\/views\/.+(\.(?:html))$/i, {
    release: '/views/test$1',
    url: '/a/b/$&'
});
harvey-woo commented 9 years ago

不太明白什么意思,我的意思是,这个文件的路径就是/a/b 而不是 /a/b.html

oxUnd commented 9 years ago

url 按照一个资源处理,带后缀的资源就带后缀,如果你想替换为其他什么 url 请用 replace 的方式,来做替换。

harvey-woo commented 9 years ago

url不带后缀很平常吧,既然按你说的,那么实际上uri的设计也是多余的,为何我不直接用release?

oxUnd commented 9 years ago

@Alphmega 对于连接 a[href] 很平常,没错,但 a[href] 不在资源定位的范畴里面。

对于资源貌似不常见吧,或者是没有必要改成别的。

很有可能其 release 和 url 的值是不一样的,比如产出时添加几层目录;

fis.match('*.js', {
  url: '/$&',
  release: '/webroot/public/$&'
});