Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Commit

Permalink
default to create manifest object
Browse files Browse the repository at this point in the history
  • Loading branch information
hariadi committed Mar 31, 2014
1 parent 6c124da commit dd2c5b7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions tasks/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function(grunt) {
querystring: {},
manifest: false
});
var manifest = grunt.manifest || {}, summary;
var manifest = grunt.manifest || {}, summary = {};

options.minifyname = '.' + options.minifyname;

Expand Down Expand Up @@ -59,10 +59,9 @@ module.exports = function(grunt) {
[basename(name, ext), suffix + options.minifyname, ext.slice(1)].join('.') :
[basename(file, ext), suffix, ext.slice(1)].join('.');

if (options.manifest) {
manifest.dest = (typeof options.manifest === 'string' || options.manifest instanceof String) ? options.manifest : path.dirname(files.dest) + '/manifest.json';
summary = { path: file, hash: suffix };
}

manifest.dest = (typeof options.manifest === 'string' || options.manifest instanceof String) ? options.manifest : path.dirname(files.dest) + '/manifest.json';
summary = { path: file, hash: suffix };

// Get target, find and change references assets to new hashed.
var wpcontent = grunt.file.read(files.dest), match, re;
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/assets/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
"hash": "51ea71910a6813fdd9ad5aeb250b2857",
"handle": "roots_main"
},
"test/fixtures/assets/css/custom.min.css": {
"path": "test/fixtures/assets/css/custom.min.css",
"hash": "45f8aa1a"
},
"test/fixtures/assets/js/scripts.min.js": {
"path": "test/fixtures/assets/js/scripts.min.js",
"hash": "71a67acb0cf0c504f45412f383d5a231",
"handle": "roots_scripts"
},
"test/fixtures/assets/css/custom.min.css": {
"path": "test/fixtures/assets/css/custom.min.css",
"hash": "45f8aa1a"
}
}
8 changes: 4 additions & 4 deletions test/fixtures/assets/manifest_withConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"path": "test/fixtures/assets/css/main.min.css",
"hash": "45f8aa1a"
},
"test/fixtures/assets/css/custom.min.css": {
"path": "test/fixtures/assets/css/custom.min.css",
"hash": "45f8aa1a"
},
"test/fixtures/assets/js/scripts.min.js": {
"path": "test/fixtures/assets/js/scripts.min.js",
"hash": "bbe2121b"
},
"test/fixtures/assets/css/custom.min.css": {
"path": "test/fixtures/assets/css/custom.min.css",
"hash": "45f8aa1a"
}
}

0 comments on commit dd2c5b7

Please sign in to comment.