gulp-useref icon indicating copy to clipboard operation
gulp-useref copied to clipboard

URL and output path need to be different

Open s1n opened this issue 8 years ago • 0 comments

So I have been learning gulp and working to deploy to a Github Page, so I setup the build reference like this:

<!-- build:js /project/scripts/combined.js-->
<link rel="text/javascript" href="/app/scripts/script.js">
<!-- endbuild-->

I'll trigger this with a gulp task that might look like this:

gulp.task('private:app:useref', () => {
      return gulp.src('./dist/**/*.html')
        .pipe(plugins.plumber())
        .pipe(plugins.useref())
        .pipe(gulp.dest('./dist/'));
    })

This will write the combined.js to the ./dist/project/scripts/ folder. However, the dist folder typically represents the document root of the github page, so I don't have a dist/project folder, I just have dist/scripts/. In order to deploy the dist folder to the gh-pages branch, I have to move the files in ./dist/project/ up to just dist. This feels clunky.

Is there a way to tell gulp-useref to write the combined file to one path with the URL it replaces being something else? In this case, I want to write combined.js to dist/scripts/combined.js and link to it in the HTML as /project/scripts/combined.js. Finding the files isn't the problem; I want the output file and the URL referenced in the gulp.src files to be be different.

s1n avatar May 31 '17 04:05 s1n