コード例 #1
0
def test_get_resources(all_files_both):
    all_resources = get_resources()
    all_resources_minified = get_resources(minify=True)
    assert all_resources.keys() == all_resources_minified.keys()
    assert all_resources.values() != all_resources_minified.values()

    all_files, all_files_minified = all_files_both
    assert all('.min.' not in f for f in all_files)
    assert any('.min.' in f for f in all_files_minified)
コード例 #2
0
"""

import os

from flask import Blueprint

from flask_statics import resource_base
from flask_statics import resource_definitions
from flask_statics import resource_definitions_angular
from flask_statics.helpers import get_resources, priority

__author__ = '@Robpol86'
__license__ = 'MIT'
__version__ = '1.0.0'
ABS_STATIC_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'static')
ALL_RESOURCES = get_resources(minify=False)
ALL_VARIABLES = sorted(ALL_RESOURCES.keys(), key=priority)
ALL_RESOURCES_MINIFIED = get_resources(minify=True)


class _StaticsState(object):
    """Remembers the configuration for the (statics, app) tuple. Modeled from SQLAlchemy."""

    def __init__(self, statics, app):
        self.statics = statics
        self.app = app


class Statics(object):
    """Static css/js resources for Flask applications.
コード例 #3
0
import os

from flask import Blueprint

from flask_statics import resource_base
from flask_statics import resource_definitions
from flask_statics import resource_definitions_angular
from flask_statics.helpers import get_resources, priority

__author__ = '@Robpol86'
__license__ = 'MIT'
__version__ = '1.0.0'
ABS_STATIC_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)),
                               'static')
ALL_RESOURCES = get_resources(minify=False)
ALL_VARIABLES = sorted(list(ALL_RESOURCES.keys()), key=priority)
ALL_RESOURCES_MINIFIED = get_resources(minify=True)


class _StaticsState(object):
    """Remembers the configuration for the (statics, app) tuple. Modeled from SQLAlchemy."""
    def __init__(self, statics, app):
        self.statics = statics
        self.app = app


class Statics(object):
    """Static css/js resources for Flask applications.

    Relevant configuration settings from the Flask app config: