Flask-Pure - a Flask extension for Pure.css¶
Flask-Pure is an extension to Flask that helps integrate Pure.css to your Flask application.
Quick Start¶
- Installation
pip install Flask-Pure
- Configuration
from flask import Flask, render_template from flask.ext.pure import Pure app = Flask(__name__) app.config['PURECSS_USE_CDN'] = True app.config['PURECSS_USE_MINIFIED'] = True Pure(app) @app.route('/') def hello(): return render_template('hello.html') if __name__ == '__main__': app.run(debug=True)
- In
templates/hello.html
:
{% extends "pure/layout.html" %} {% block title %}Hello world from flask-pure{% endblock %} {% block nav %} <div class="pure-menu pure-menu-horizontal"> <!-- ... --> </div> {% endblock %} {% block content %} <h1>Hello world</h1> {% endblock %}
- Profit!
License¶
BSD New, see LICENSE for details.
Links¶
Configuration¶
Option | Description |
---|---|
PURECSS_USE_CDN |
If True , css files will be served from
CDN. If False , local copies of css files
will be served. Default value is True . |
PURECSS_USE_MINIFIED |
If True , the minified version of css files
will be used. Default value is True |
Template¶
In addition to provide Pure.css static assets, Flask-Pure comes with
HTML5
template located in pure/layout.html
for layout.
Predefined Blocks | Purpose |
---|---|
html_attribs |
<html> ‘s attributes |
head |
all content inside <head> and </head> |
meta |
for all <meta> tags |
title |
content inside <title> and </title> |
style |
links to css stylesheets |
body_attribs |
<body> ‘s attributes |
body |
all content inside <body> and </body> |
nav |
navigation links |
content |
main content |
script |
embedded javascript |
API¶
Flask-Pure - a Flask extension for Pure.css