Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blade依赖资源路径错误 #14

Open
finchcn opened this issue Sep 6, 2016 · 3 comments
Open

blade依赖资源路径错误 #14

finchcn opened this issue Sep 6, 2016 · 3 comments

Comments

@finchcn
Copy link

finchcn commented Sep 6, 2016

blade中require资源写绝对路径会被格式化为相对路径,layout中的require在继承了之后会出现静态资源加载不上的问题,最明显的是modjs在浏览器中表现为js/mod.js无法找到,比如我的路径是http://xxx.com/a/b
那么modjs的路径就是http://xxx.com/a/js/mod.js

@finchcn
Copy link
Author

finchcn commented Sep 6, 2016

是哪一步正则替换把绝对路径的/开头去掉了

@finchcn
Copy link
Author

finchcn commented Sep 6, 2016

好吧自己解决了
// static 下面本来就是静态资源,去掉多出来的一层目录。
fis.match('/static/(**)', {
release: '/public/$1',
url: '/$1'
});

url $1前面加上/即可
不知道这样做是否符合规范

@damoclesX
Copy link

我本地调试的时候也这样搞,因为fis都是转成绝对路径。有一个相对路径的插件fisx-hook-relative。不过正式上线的时候,静态资源都放cdn,直接使用domain就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants