I am using gulp useref to replace my files in my index.html after I minify them. I can get useref to work when I pass a path, but I would like to have it keep the file's original path when I don't define a path. I know I could go through and add the build path comment to each file or that I could just run a task to minify all other files. That just seems crazy and pointless if useref can output the original path then this task to would do it all.
Example - to note stripped code for example aka rel="".
HTML file:
<!-- build:css I want this to return original path into my new "dist" folder. Like **/* -->
<link href="fonts/map/map.css">
<link href="layout/item/item.css">
<!-- endbuild -->
this works bc path is defined and the files exist in the same folder.
gulp.task('css', function () {
return gulp.src('index.html')
.pipe(useref())
.pipe(minifyCss())
.pipe(gulp.dest('dist'));
});
Resulting HTML - the index.html file is outputed to the "dist" folder and the .css files are minified. This all works, but noticed the href = "replace" bc nothing was defiened in the comments for path, also a file named undefined is outputed in the dist folder:
I am using gulp useref to replace my files in my index.html after I minify them. I can get useref to work when I pass a path, but I would like to have it keep the file's original path when I don't define a path. I know I could go through and add the build path comment to each file or that I could just run a task to minify all other files. That just seems crazy and pointless if useref can output the original path then this task to would do it all.
Also posted the question on Stackoverflow: http://stackoverflow.com/questions/34794378/gulp-useref-how-can-you-return-original-path
Example - to note stripped code for example aka rel="".
HTML file:
this works bc path is defined and the files exist in the same folder.
Gulp Task:
Resulting HTML - the index.html file is outputed to the "dist" folder and the .css files are minified. This all works, but noticed the href = "replace" bc nothing was defiened in the comments for path, also a file named undefined is outputed in the dist folder:
and what I want is...