Skip to content

URL and output path need to be different #238

@s1n

Description

@s1n

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions