作为我的grunt:build命令的一部分,我运行一个shell任务,该任务构建了我的jekyll网站,提交了项目,并将其推送到github。唯一的问题是提交消息。我希望能够调用grunt:build并传递一个字符串,该字符串将成为我的提交消息。但是我不确定如何使它工作。有什么想法吗?
这是我的Gruntfile的相关部分:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
shell: {
dev: {
command: 'jekyll build'
},
build: {
command: [
'jekyll build',
'git commit -am "test commit"',
'git push origin master'
].join('&&')
}
}
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('build', ['jshint','concat', 'uglify','sass', 'autoprefixer','shell:build']);
};
试试grunt.option()
(http://gruntjs.com/api/grunt.option):
'git commit -am "' + grunt.option('commit-msg') + '"',
并运行: grunt build --commit-msg="test commit"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句