Skip to content

cachebust.references() won't replace paths with directory names that begin with a period character #6

@EdMakes

Description

@EdMakes

cachebust.references() fails to match paths that starts with a folder name beginning with a period.

var gulp = require("gulp"),
  concat = require("gulp-concat"),
  inject = require("gulp-inject"),
  uglify = require("gulp-uglify"),
  CacheBuster = require("gulp-cachebust");

var cachebust = new CacheBuster();

gulp.task("min:js", function () {
  return gulp.src([
    "./app/*.js",
    "./app/**/*.js"
  ])
    .pipe(concat("./.build/js/bundled.min.js"))
    .pipe(uglify())
    .pipe(gulp.dest(".")) // writes out the original file for injection
    .pipe(cachebust.resources())
    .pipe(gulp.dest(".")); // writes the busted file
});

gulp.task("inject:index", function () {
  return gulp.src('./templates/index.html' })
    .pipe(inject(gulp.src('./.build/js/bundled.min.js', { read: false })))
    .pipe(cachebust.references())
    .pipe(gulp.dest('./.build/templates'));
});

After running tasks min:js followed by inject:js, the file written to /.build/templates/index.html contains the original file path instead of the expected busted file path. The busted file is generated.

Changing the /.build folder name to one that does not start with a period (ex: /build) works around the problem.

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