Skip to main content

Flask-Pure - a Flask extension for Pure.css

Project description

Flask-Pure is an extension to Flask that helps integrate Pure.css to your Flask application.

Quick Start

  1. Installation

pip install Flask-Pure
  1. Configuration

from flask import Flask, render_template
from flask.ext.pure import Pure

app = Flask(__name__)
app.config['PURECSS_RESPONSIVE_GRIDS'] = True
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)
  1. 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 %}
  1. Profit!

How It Works

Once registered, this extension provides a template variable called pure, it has a property named css that will be rendered as HTML <link> tag to the Pure.css stylesheets either from free CDN or be served from a bundled blueprint, also called pure.

A {{ pure.css }} inside <head> tag is all you need.

A bare bone HTML5 template is also available as pure/layout.html. Please check out the example in code repository and documentation for details.

License

BSD New, see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-Pure-0.2.tar.gz (21.1 kB view details)

Uploaded Source

File details

Details for the file Flask-Pure-0.2.tar.gz.

File metadata

  • Download URL: Flask-Pure-0.2.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Flask-Pure-0.2.tar.gz
Algorithm Hash digest
SHA256 82ca558b814b7ce40e05022f1f07ca3e0ce4d6b5c73eaba0f214bc6cf2812b5c
MD5 c52e2e512e36e59d532d38a55aadfd62
BLAKE2b-256 03ad942fe3d87ea4ba2f9c62313fe0411a3ac901694f62a27b799ab720c7d81c

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page