简体   繁体   English

Gulp的路径怎么写?

[英]Gulp how to write path's?

I am using gulp and I am confused that after build all my paths are wrong.我正在使用 gulp 并且我很困惑,在构建之后我的所有路径都是错误的。

For Example:例如:

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

After buiild:构建后:

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

Your paths in gulpfile.js should look like that:您在 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 versus /*.png check only test.png and not all images. /test.png 与 /*.png 仅检查 test.png 而不是所有图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM