コード例 #1
0
def clear_css_cache():
    import logging
    from webassets.script import CommandLineEnvironment

    # Setup a logger
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.clean()
コード例 #2
0
def bundle(**kwargs):
    """
    Webassets bundle management.

    usage: blueberrypy bundle [options]

    Before you can use this command to bundle up your Web assets, you should
    have created either a project skeleton using the 'create' command or
    provided a configuration directory using the global option -c --config_dir.

    options:
      -h, --help                                show this help message and exit
      -C ENV_VAR_NAME, --env-var ENV_VAR_NAME   add the given config from
                                                environment variable name
                                                [default: BLUEBERRYPY_CONFIG]
      -b, --build                               build the asset bundles
      -w, --watch                               automatically rebuild the
                                                asset bundles upon changes in
                                                the static directory
      -c, --clean                               delete the generated asset bundles

    """

    config = BlueberryPyConfiguration(config_dir=kwargs.get('config_dir'),
                                      env_var_name=kwargs.get('env_var'))

    assets_env = config.webassets_env
    if not assets_env:
        raise BlueberryPyNotConfiguredError("Webassets configuration not found.")

    from webassets.script import CommandLineEnvironment
    assets_cli = CommandLineEnvironment(assets_env, logger)

    if kwargs.get("build"):
        try:
            assets_cli.build()
        except AttributeError:
            assets_cli.rebuild()
    elif kwargs.get("watch"):
        assets_cli.watch()
    elif kwargs.get("clean"):
        assets_cli.clean()
コード例 #3
0
ファイル: command.py プロジェクト: wyuenho/blueberrypy
def bundle(**kwargs):
    """
    Webassets bundle management.

    usage: blueberrypy bundle [options]

    Before you can use this command to bundle up your Web assets, you should
    have created either a project skeleton using the 'create' command or
    provided a configuration directory using the global option -c --config_dir.

    options:
      -h, --help   show this help message and exit
      -b, --build  build the asset bundles
      -w, --watch  automatically rebuild the asset bundles upon changes in the
                   static directory
      -c, --clean  delete the generated asset bundles

    """

    config = BlueberryPyConfiguration(config_dir=kwargs.get("config_dir"))

    assets_env = config.webassets_env
    if not assets_env:
        raise BlueberryPyNotConfiguredError("Webassets configuration not found.")

    from webassets.script import CommandLineEnvironment
    assets_cli = CommandLineEnvironment(assets_env, logger)

    if kwargs.get("build"):
        try:
            assets_cli.build()
        except AttributeError:
            assets_cli.rebuild()
    elif kwargs.get("watch"):
        assets_cli.watch()
    elif kwargs.get("clean"):
        assets_cli.clean()
コード例 #4
0
ファイル: manage.py プロジェクト: adrien-f/eveask
def clean_assets():
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)
    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.clean()
コード例 #5
0
ファイル: __init__.py プロジェクト: gregersn/whathappened
def clean():
    """Clean bundles."""
    cmdenv = CommandLineEnvironment(current_app.jinja_env.assets_environment, logger)
    cmdenv.clean()