Source code for flask_pure

# -*- coding: utf-8 -*-
# Copyright (c) 2016, Philip Xu <pyx@xrefactor.com>
# License: BSD New, see LICENSE for details.
"""Flask-Pure - a Flask extension for Pure.css"""

from flask import Blueprint, Markup, current_app, url_for

__version__ = '0.1'
__all__ = ['get_css_links', 'Pure']

CDN_PREFIX = 'http://yui.yahooapis.com/pure/0.6.0/'
LINK_TEMPLATE = '<link rel="stylesheet" href="%s">'





[docs]class Pure(object): """Flask-Pure extension provides base template layout as :code:`pure/layout.html` and links to the Pure.css static assets. """ def __init__(self, app=None): self.app = app if app is not None: self.init_app(app)
[docs] def init_app(self, app): """create and register a blueprint with the Flask application. :param app: Flask application instance """ app.config.setdefault('PURECSS_USE_CDN', True) app.config.setdefault('PURECSS_USE_MINIFIED', True) pure = Blueprint( 'pure', __name__, template_folder='templates', static_folder='static', static_url_path=app.static_url_path + '/pure/css') app.register_blueprint(pure) app.context_processor(get_css_links) if not hasattr(app, 'extensions'): app.extensions = {} app.extensions['pure'] = self