Add filter fileExists

This commit is contained in:
Samy Pessé
2016-02-25 14:50:58 +01:00
parent 3cda0643fb
commit b240d6a8fc
+5
View File
@@ -110,6 +110,11 @@ WebsiteOutput.prototype.prepare = function() {
return location.normalize(that.resolveForPage(this.ctx.file.path, href));
});
// Test if a file exists
that.env.addFilter('fileExists', function(href) {
return fs.existsSync(that.resolve(href));
});
// Transform a '.md' into a '.html' (README -> index)
that.env.addFilter('contentURL', function(s) {
return location.normalize(that.outputUrl(s));