Created
April 12, 2019 20:38
-
-
Save makkoncept/9cc294c2fd7bce600e0f8df8b5149d2d to your computer and use it in GitHub Desktop.
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
import os | |
from lektor.pluginsystem import Plugin | |
class CheckfilePlugin(Plugin): | |
name = 'CheckFile' | |
description = u'Plugin to check if a file is present' | |
def on_setup_env(self, **extra): | |
def check_file(filename): | |
fn = os.path.join(self.env.root_path, filename) | |
assert os.path.isfile(fn), 'file {} does not exist'.format(fn) | |
self.env.jinja_env.globals.update( | |
check_file=check_file | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment