当前位置: 首页>>代码示例>>Python>>正文


Python CommandLineEnvironment.watch方法代码示例

本文整理汇总了Python中webassets.script.CommandLineEnvironment.watch方法的典型用法代码示例。如果您正苦于以下问题:Python CommandLineEnvironment.watch方法的具体用法?Python CommandLineEnvironment.watch怎么用?Python CommandLineEnvironment.watch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在webassets.script.CommandLineEnvironment的用法示例。


在下文中一共展示了CommandLineEnvironment.watch方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _init_webassets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
def _init_webassets(debug=False):
    assets_env = Environment(directory=SITE_ASSET_DIR,
                             url=SITE_ASSET_URL_PREFIX,
                             cache=WEBASSETS_CACHE_DIR,
                             load_path=[SITE_ASSET_SRC_DIR])
    assets_env.debug = debug

    js = Bundle('js/*.js', filters='uglifyjs', output='js/app.js')
    css = Bundle('sass/*.scss', filters='scss,cssmin', output='css/app.css')

    assets_env.register('app_js', js)
    assets_env.register('app_css', css)

    cmd = CommandLineEnvironment(assets_env, log)

    p = Process(target=lambda: cmd.watch())

    def signal_handler(sig, frame):
        try:
            p.terminate()
        except Exception:
            pass
        sys.exit(0)

    signal.signal(signal.SIGINT, signal_handler)
    p.start()

    return assets_env
开发者ID:jackzhangpython,项目名称:PyConChina2016,代码行数:30,代码来源:gen.py

示例2: bundle

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
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()
开发者ID:wyuenho,项目名称:blueberrypy,代码行数:39,代码来源:command.py

示例3: _init_webassets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
def _init_webassets(debug=False, generate=False):
    assets_env = Environment(directory=SITE_ASSET_DIR,
                             url=SITE_ASSET_URL_PREFIX,
                             cache=WEBASSETS_CACHE_DIR,
                             load_path=[SITE_ASSET_SRC_DIR])
    assets_env.debug = debug

    js = Bundle('js/*.js', filters='uglifyjs', output='js/app.js')
    css = Bundle('sass/*.scss', filters='scss,cssmin', output='css/app.css')

    assets_env.register('app_js', js)
    assets_env.register('app_css', css)

    cmd = CommandLineEnvironment(assets_env, log)

    if generate:
        cmd.build()
        return assets_env

    Process(target=lambda: cmd.watch()).start()

    return assets_env
开发者ID:PyConChina,项目名称:PyConChina2016,代码行数:24,代码来源:gen.py

示例4: watch

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
def watch(debug=False, cache=False):
    env = _setup_env(debug, cache)
    log = _load_logger()
    cmdenv = CommandLineEnvironment(env, log)

    cmdenv.watch()
开发者ID:Workiva,项目名称:gae-financials,代码行数:8,代码来源:assets.py

示例5: watch_assets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
def watch_assets():
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)
    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.watch()
开发者ID:adrien-f,项目名称:eveask,代码行数:8,代码来源:manage.py

示例6: Bundle

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import watch [as 别名]
    filters='uglifyjs',
    output='js/electris-footer.min.js')

css = Bundle(
    'bootstrap/css/bootstrap.min.css',
    'bootstrap/css/bootstrap-responsive.min.css',
    'css/template.css',
    'css/app.css',
    'css/sponsorship.css',
    filters='yui_css',
    output='css/electris.min.css')

static.register('js_header', header_js)
static.register('js_footer', footer_js)
static.register('css', css)

header_js.urls()
footer_js.urls()
css.urls()

import logging
from webassets.script import CommandLineEnvironment

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

cmdenv = CommandLineEnvironment(static, log)
cmdenv.watch()
开发者ID:imclab,项目名称:electris,代码行数:32,代码来源:watch.py


注:本文中的webassets.script.CommandLineEnvironment.watch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。