【发布时间】:2014-12-16 23:05:39
【问题描述】:
不知道我做错了什么。 这是 grunt 后我的 css 的样子,但我的实际图像文件名是
backgorund-with-logo.d623d8e2.jpg
.containor{
min-height: 100%;
background: url('/images/backgorund-with-logo.d623d8e2.jpg') center 30% no-repeat;
background-size: 100%;
}
Grunt 文件
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
options: {
assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/images'
}]
}
},
filerev: {
dist: {
src: [
'<%= yeoman.dist %>/scripts/{,*/}*.js',
'<%= yeoman.dist %>/styles/{,*/}*.css',
'<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= yeoman.dist %>/styles/fonts/*'
]
}
},
但是当我尝试在我的 android 设备上运行并通过 chrome 进行检查时 资源文件加载失败:///images/backgorund-with-logo.d623d8e2.jpg
请帮忙
【问题讨论】:
-
您能否验证图像名称是 backgorund-with-logo.jpg 而不是 background-with-logo.jpg。也是android特有的问题吗?
-
文件名没问题。我查看了图像文件夹并且图像存在。 android 和 ios 都在发生这种情况
-
如果我没记错,它应该从文件中加载图像:///android_asset/www/images/... 但不知道该怎么做
标签: javascript css angularjs cordova gruntjs