Skip to content

Commit

Permalink
add HTMLHint.release
Browse files Browse the repository at this point in the history
  • Loading branch information
yaniswang committed Oct 13, 2015
1 parent 3b39e55 commit f9a49c1
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
34 changes: 33 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ module.exports = function(grunt) {
options: {
prefix: '@',
variables: {
'VERSION': '<%= pkg.version %>'
'VERSION': '<%= pkg.version %>',
'RELEASE': dateFormat('yyyyMMdd')
}
}
}
Expand All @@ -85,4 +86,35 @@ module.exports = function(grunt) {

grunt.registerTask('default', ['build', 'exec:cover', 'uglify', 'replace:version']);

function dateFormat(date, format) {
if(format === undefined){
format = date;
date = new Date();
}
var map = {
"M": date.getMonth() + 1, //月份
"d": date.getDate(), //日
"h": date.getHours(), //小时
"m": date.getMinutes(), //分
"s": date.getSeconds(), //秒
"q": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
format = format.replace(/([yMdhmsqS])(\1)*/g, function(all, t){
var v = map[t];
if(v !== undefined){
if(all.length > 1){
v = '0' + v;
v = v.substr(v.length-2);
}
return v;
}
else if(t === 'y'){
return (date.getFullYear() + '').substr(4 - all.length);
}
return all;
});
return format;
}

};
Loading

0 comments on commit f9a49c1

Please sign in to comment.