gulp-rev-append
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -6,3 +6,3 @@ var chai = require('chai'); | ||
var FILE_DECL = /(?:href|src)="(.*)[\?]rev=(.*)[\"]/gi; | ||
var FILE_DECL = /(?:href|src)=['|"]([^\s>"']+?)\?rev=([^\s>"']+?)['|"]/gi; | ||
@@ -21,3 +21,3 @@ module.exports = function() { | ||
path: 'test/fixtures/static/index.html', | ||
contents: new Buffer(this.htmlFileContents) | ||
contents: new Buffer(this.htmlFileContents('index')) | ||
}); | ||
@@ -24,0 +24,0 @@ callback(); |
@@ -5,3 +5,2 @@ 'use strict'; | ||
var basePath = path.join(process.cwd(), 'test', 'fixtures', 'static'); | ||
var indexPath = [basePath, 'index.html'].join(path.sep); | ||
@@ -13,9 +12,6 @@ var World = function World(callback) { | ||
this.plugin = require('../../'); | ||
this.htmlFileContents = ''; | ||
(function(world) { | ||
fs.readFile(indexPath, function(err, data) { | ||
world.htmlFileContents = data.toString(); | ||
callback(); | ||
}); | ||
}(this)); | ||
this.htmlFileContents = function(filename) { | ||
return fs.readFileSync([basePath, filename + '.html'].join(path.sep)); | ||
}; | ||
callback(); | ||
@@ -22,0 +18,0 @@ }; |
12
index.js
@@ -9,3 +9,3 @@ var fs = require('fs'); | ||
var FILE_DECL = /(?:href|src)="(.*)[\?]rev=(.*)[\"]/gi; | ||
var FILE_DECL = /(?:href|src)=['|"]([^\s>"']+?)\?rev=([^\s>"']+?)['|"]/gi; | ||
@@ -32,3 +32,11 @@ var revPlugin = function revPlugin() { | ||
if(groups && groups.length > 1) { | ||
dependencyPath = path.resolve(path.dirname(file.path), groups[1]); | ||
// are we an "absoulte path"? (e.g. /js/app.js) | ||
var normPath = path.normalize(groups[1]); | ||
if (normPath.indexOf(path.sep) === 0) { | ||
dependencyPath = path.join(file.base, normPath); | ||
} | ||
else { | ||
dependencyPath = path.resolve(path.dirname(file.path), normPath); | ||
} | ||
try { | ||
@@ -35,0 +43,0 @@ data = fs.readFileSync(dependencyPath); |
{ | ||
"name": "gulp-rev-append", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Cache-busting plugin for gulp.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53994
21
121