grunt checkglob --target=yourtask.option.property
Last active
August 29, 2015 14:11
-
-
Save k-maru/4c7a601fa50308076603 to your computer and use it in GitHub Desktop.
Grunt glob expand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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