Gulp如何写路径的?

问题描述 投票:0回答:1

我使用的是gulp,我很困惑,在构建之后,我的所有路径都是错误的。

例如:

SRC : 

pages -> home.html, buy.html  (src="../assets/img/test/test.png" used to get all images)
partials -> navigation.html, footer.html
assets -> js,scss,img folders
layouts -> layout.html

在建筑物后:

DIST : 

assets -> js,css,img folders
home.html (with ../assets.... url's) - dont work, wrong path
buy.html (with ../assets.... url's) - dont work, wrong path
javascript html gulp
1个回答
0
投票
您在gulpfile.js中的路径应如下所示:

'use strict' var gulp = require('gulp') var fontmin = require('gulp-fontmin') // ... gulp.task('fonts:parent', function () { return gulp.src('./builder/site/parent/fonts/**/*.ttf') .pipe(fontmin()) .pipe(gulp.dest('./final/frame/themes/gate/assets/fonts')) }); // Watch gulp.task('gulp:watch', [ 'fonts:parent', ], function() { gulp.watch('./builder/site/parent/fonts/**/*.ttf', ['fonts:parent']) }); gulp.task('default', ['gulp:watch'])
/ test.png与/*.png仅检查test.png而不是全部图像。
© www.soinside.com 2019 - 2024. All rights reserved.