gulp-inline-source
gulp-inline-source copied to clipboard
Doesn't resolve same-directory relative pathnames correctly
/webroot/gulpfile.js:
gulp.task( 'inline:templates', function () {
var inlineSourceOptions = {
// attribute: 'inline',
compress: false,
pretty: true
};
return gulp.src( './build/templates/**/*.html', {
base: './build/foo/'
} )
.pipe( $.inlineSource( inlineSourceOptions ) )
.pipe( gulp.dest( './build/templates/' ) )
;
} );
/webroot/build/templates/foo/bar/:
- index.html
- style.css
/webroot/build/templates/foo/bar/index.html:
<link href="style.css" inline>
gulp inline:templates:
events.js:154 throw er; // Unhandled 'error' event ^ Error: ENOENT: no such file or directory, open '/webroot/build/templates/style.css' at Error (native)
In order to get gulp-inline-source to work I instead have to use a leading dot and slash, e.g. <link href="./style.css" inline>. This is unnecesary from a URL perspectvie, and not immediately obvious (I spent a lot of time debugging to figure this out).