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

修正获取图片资源绝对路径Bug #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dafrok
Copy link

@Dafrok Dafrok commented Jan 8, 2016

环境OS X10.11/node 0.12.7,当background-image的url使用绝对地址时(如:background: url(/resource/foo.png) ),getAbsolutePath函数拿到的sourcePath参数首位字符是”/“,这会导致path.resolve认为sourcePath是文件系统root上的目录。

@yisibl
Copy link
Contributor

yisibl commented Jan 8, 2016

好的,非常感谢,我抽时间 review 一下后 merge。

@gucong3000
Copy link
Contributor

建议新增一个配置项,告诉代码该去哪里寻找绝对路径的根目录,默认值为process.cwd()

然后path.join(option.rootPath || process.cwd(), sourcePath)

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

Successfully merging this pull request may close these issues.

3 participants