简体   繁体   中英

Gulp how to write path's?

I am using gulp and I am confused that after build all my paths are wrong.

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:

 '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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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