Comparing version 1.0.4 to 1.1.0
@@ -11,7 +11,8 @@ 'use strict'; | ||
//use assert to require filesPath, outputDir | ||
(0, _assert2.default)(options.files, 'files property is required'); | ||
var filesPath = options.files; | ||
var outputDir = options.outputDir; | ||
var outputDir = options.outputDir || __dirname; | ||
var outputDest = _path2.default.resolve(outputDir); | ||
var file = options.file; | ||
var hash = options.hash; | ||
var hash = options.hash || false; | ||
@@ -27,4 +28,10 @@ function writeManifest(manifest) { | ||
var files = _glob2.default.sync(_path2.default.resolve(filesPath), {}); | ||
var filesPathParts = filesPath.split(','); | ||
var files = []; | ||
filesPathParts.forEach(function (filePathPart) { | ||
files = files.concat(files, _glob2.default.sync(_path2.default.resolve(filePathPart), {})); | ||
}); | ||
console.log(files); | ||
var baseDir = void 0; | ||
@@ -60,2 +67,3 @@ if (files && files.length === 1) { | ||
} else { | ||
console.warn('No files found matching ' + _path2.default.resolve(filesPath)); | ||
writeManifest({}); | ||
@@ -62,0 +70,0 @@ } |
{ | ||
"name": "node-rev", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "cli and node api version of gulp/grunt-rev, uses rev-path, rev-hash to generate a json of assets", | ||
@@ -5,0 +5,0 @@ "keywords": "rev, rev-path, rev-hash, assets, manifest", |
@@ -46,4 +46,16 @@ 'use strict'; | ||
}); | ||
lab.test('takes multiple glob patterns separated by commas', function (done) { | ||
(0, _index2.default)({ | ||
files: 'fixtures/**/*.css,fixtures/**/*.js', //glob to files you want in the manifest | ||
outputDir: 'tmp/', //where you want the files to be output that are part of the manifest | ||
file: 'tmp/assets.json', //optional, allows you to specify location of manifest file and name it, default is root of the project | ||
hash: true //if you are in dev mode, you can set this to false to just have it create the manifest with the same filenames | ||
}); | ||
var file = _fs2.default.readFileSync('./tmp/assets.json', 'utf8'); | ||
var manifest = JSON.parse(file); | ||
expect(manifest['test.css']).to.startWith('test-'); | ||
done(); | ||
}); | ||
}); | ||
//# sourceMappingURL=node-rev.js.map | ||
//# sourceMappingURL=node-rev.js.map |
@@ -1,1 +0,1 @@ | ||
{"test.css":"test-934823cbc6.css"} | ||
{"test.css":"test-934823cbc6.css","test.js":"test-cd890c4c15.js"} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
79814
26
316