Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EdMakes opened this issue Nov 8, 2017 · 0 comments

Comments

@EdMakes
Copy link

EdMakes commented Nov 8, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant