Angularjs gulp字体任务不将roboto fontface文件添加到dist文件夹
我正在使用Angularjs gulp字体任务不将roboto fontface文件添加到dist文件夹,angularjs,fonts,gulp,Angularjs,Fonts,Gulp,我正在使用gulp-service:dist构建角度项目,但当索引页面呈现时,所有roboto字体都会出现404错误。看 在github上搜索了许多和,但到目前为止没有一个有效。这是我的文件夹结构和代码 /应用程序/ /bower_组件/roboto fontface/ /bower_组件/roboto fontface/bower.json 这里是完成和相关的字体任务 gulp.task('fonts', function () { return gulp.src($.mainBowerF
gulp-service:dist
构建角度项目,但当索引页面呈现时,所有roboto字体都会出现404错误。看
在github上搜索了许多和,但到目前为止没有一个有效。这是我的文件夹结构和代码
/应用程序/
/bower_组件/roboto fontface/
/bower_组件/roboto fontface/bower.json
这里是完成和相关的字体任务
gulp.task('fonts', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{otf,eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));
});
试验1
gulp.task('copyfonts', function() {
return gulp.src('../bower_components/roboto-fontface/fonts/**/*.{eot,svg,ttf,woff,woff2}')
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/fonts/')));
});
及
这行不通
试验2
gulp.task('fonts:dev', function () {
return gulp.src($.mainBowerFiles())
.pipe($.filter('**/*.{eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/fonts/')));
});
但这会将字体awesome和glyphicon.{eot、svg、ttf、woff、woff2}文件添加到serve/fonts/中,这些文件已经在dist/fonts文件夹中
试验3
在主应用程序/bower.json中添加
但仍然不起作用
更新(工作) 上面的工作正常,但这里我需要将正面复制到/font/Roboto文件夹中 如果我没有在
gulp.dest
中添加Roboto文件夹,404错误就会出现,因为它正在fonts/Roboto文件夹中查找字体
在哪里将字体/Roboto文件夹名称更改为默认的/fonts文件夹?这里是如何实现的。首先将版本更新为roboto fontface 0.7.0,并应用以下步骤
"overrides": {
"roboto-fontface": {
"main": [
"css/roboto/less/roboto-fontface.less"
]
}
}
@import "../../bower_components/roboto-fontface/css/roboto/less/roboto-fontface.less";
@roboto-font-path: "../../bower_components/roboto-fontface/fonts";
html
任务中添加以下行
.pipe($.replace('../../bower_components/roboto-fontface/fonts/', '../fonts/'))
.pipe($.replace('../../bower_components/fontawesome/fonts/', '../fonts/'))
gulp.task('copyfonts', function() {
return gulp.src($.mainBowerFiles().concat('bower_components/roboto-fontface/fonts/Roboto/*'))
.pipe($.filter('{Roboto-Thin,Roboto-Medium,Roboto-Bold,Roboto-Regular}.{eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/Roboto/')));
});
gulp.task('war', ['html', 'fonts', 'copyfonts', 'other'], function () {
// copy Roboto fonts into Roboto Directory
gulp.task('copyfonts', function() {
return gulp.src($.mainBowerFiles().concat('bower_components/roboto-fontface/fonts/roboto/*'))
.pipe($.filter('{Roboto-Black,Roboto-Bold,Roboto-Medium,Roboto-Regular}.{eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/Roboto')));
});
"overrides": {
"roboto-fontface": {
"main": [
"css/roboto/less/roboto-fontface.less"
]
}
}
@import "../../bower_components/roboto-fontface/css/roboto/less/roboto-fontface.less";
@roboto-font-path: "../../bower_components/roboto-fontface/fonts";
.pipe($.replace('../../bower_components/roboto-fontface/fonts/', '../fonts/'))
.pipe($.replace('../../bower_components/fontawesome/fonts/', '../fonts/'))
gulp.task('copyfonts', function() {
return gulp.src($.mainBowerFiles().concat('bower_components/roboto-fontface/fonts/Roboto/*'))
.pipe($.filter('{Roboto-Thin,Roboto-Medium,Roboto-Bold,Roboto-Regular}.{eot,svg,ttf,woff,woff2}'))
.pipe($.flatten())
.pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/Roboto/')));
});
gulp.task('war', ['html', 'fonts', 'copyfonts', 'other'], function () {