Skip to content

Instantly share code, notes, and snippets.

@k-maru
Last active August 29, 2015 14:11
Show Gist options
  • Save k-maru/4c7a601fa50308076603 to your computer and use it in GitHub Desktop.
Save k-maru/4c7a601fa50308076603 to your computer and use it in GitHub Desktop.
Grunt glob expand
grunt checkglob --target=yourtask.option.property
grunt.registerTask("checkglob", "check glob expanded filed", function(){
var config = grunt.config,
target = grunt.option("target") + "",
props = target.split("."),
value = config.data;
props.forEach(function(prop){
if(typeof value === "undefined"){
return;
}
value = value[prop];
});
if(value){
grunt.file.expand(value).forEach(function(path){
grunt.log.writeln(path);
});
}else{
grunt.fail.warn("Can't find value or target property.");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment