Skip to main content

Provides Bootstrap3 and other static resources in a modular fashion.

Project description

Provides Bootstrap3 and other static resources in a modular fashion.

Supported Platforms

  • OSX and Linux.

  • Python 2.7

  • Flask 0.10.1

Quickstart

Install:

pip install Flask-Statics-Helper

Enable:

# example.py
from flask import Flask
from flask.ext.statics import Statics

app = Flask(__name__)
Statics(app)

Use with Bootstrap3 (automatically enables jQuery):

{% extends 'flask_statics_helper/bootstrap.html' %}
{% set STATICS_ENABLE_RESOURCE_CSSHAKE = True %}
{% block title %}My Application{% endblock %}

{% block navbar %}
    <div class="navbar navbar-inverse navbar-static-top" role="navigation">
        <div class="container">
            <div class="navbar-header"> <!-- navbar-header -->
                <button type="button" class="navbar-toggle" data-toggle="collapse"
                        data-target=".navbar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="/">My Application</a>
            </div> <!-- /navbar-header -->
            <div class="collapse navbar-collapse"> <!-- navbar-collapse -->
                <ul class="nav navbar-nav">
                    <li><a href="/">Home</a></li>
                </ul>
            </div> <!-- /navbar-collapse -->
        </div>
    </div>
{% endblock %}

{% block container %}
    <div class="jumbotron">
        <h2 class="shake shake-constantly">Hello World.</h2>
    </div>
{% endblock %}

Available Resources

Configuration

The only app.config specific setting is STATICS_MINIFY. Everything else may be set to True either in individual templates (so that css/js is included only for that template) or you may set it to True in the app.config if you want the resource enabled for all templates for some reason or another.
AngularJS resources (like angular-animate.js) must also set STATICS_ENABLE_RESOURCE_ANGULARJS to true, since setting``STATICS_ENABLE_RESOURCE_ANGULARJS_ANIMATE`` won’t automatically include the angular.js file.

The following config settings are searched for in the Flask application’s configuration dictionary:

  • STATICS_MINIFY – Have minified resources selected instead of uncompressed resources.

  • STATICS_ENABLE_RESOURCE_ANGULARJS – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_BOOTSTRAP – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_BOOTSTRAP_EDITABLE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_BOOTSTRAP_GROWL – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_BOOTSTRAP_TYPEAHEAD – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_CSSHAKE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_D3 – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_DATATABLES – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_FONT_AWESOME – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_JQUERY – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_WHHG_FONT – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_ANIMATE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_COOKIES – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_CSP – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_LOADER – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_MESSAGES – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_MOCKS – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_RESOURCE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_ROUTE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_SANITIZE – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_SCENARIO – include resource in all templates.

  • STATICS_ENABLE_RESOURCE_ANGULARJS_TOUCH – include resource in all templates.

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-Statics-Helper-0.1.0.tar.gz (3.2 MB view hashes)

Uploaded Source

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