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


Python CommandLineEnvironment.build方法代码示例

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


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

示例1: _build_webassets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
 def _build_webassets(self):
     # Set up a logger
     log = logging.getLogger('webassets')
     log.addHandler(logging.StreamHandler())
     log.setLevel(logging.DEBUG)
     cmdenv = CommandLineEnvironment(self.webassets_env, log)
     cmdenv.build()
开发者ID:gharp,项目名称:Ubiqu-Ity,代码行数:9,代码来源:__init__.py

示例2: js

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def js():
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.WARNING)

    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.build()
开发者ID:nukomeet,项目名称:kulfon,代码行数:9,代码来源:kulfon.py

示例3: static

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def static(path, input):
    '''Compile and collect static files'''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    if exists(path):
        print('"{0}" directory already exists and will be erased'.format(path))
        if input and not prompt_bool('Are you sure'):
            exit(-1)

    cmdenv = CommandLineEnvironment(assets, log)
    # cmdenv.clean()
    cmdenv.build(production=True)

    print('Deleting static directory {0}'.format(path))
    shutil.rmtree(path)

    print('Copying assets into "{0}"'.format(path))
    shutil.copytree(assets.directory, path)

    for prefix, source in manager.app.config['STATIC_DIRS']:
        print('Copying %s to %s', source, prefix)
        destination_path = join(path, prefix)
        if not exists(destination_path):
            makedirs(destination_path)
        for filename in iglob(join(source, '*')):
            print(filename)
            if isdir(filename):
                continue
            shutil.copy(filename, destination_path)
        # shutil.copy(static_dir, path)

    print('Done')
开发者ID:rossjones,项目名称:udata,代码行数:36,代码来源:static.py

示例4: main

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def main():
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    call(["coffee", "-c", "src/tambur.coffee"])
    call(["coffee", "-c", "src/tambur_publisher.coffee"])

    env = Environment('.', '/static')
    tamburjs = Bundle(
            'deps/sockjs-0.3.js',
            'src/tambur.js', output='out/tambur.js')
    tamburminjs = Bundle(
            'deps/sockjs-0.3.js',
            'src/tambur.js', filters='yui_js', output='out/tambur.min.js')
    publishjs = Bundle(
            'deps/sha1.js',
            'deps/oauth.js',
            'src/tambur_publisher.js', output='out/tambur_pub.js')
    publishminjs = Bundle(
            'deps/sha1.js',
            'deps/oauth.js',
            'src/tambur_publisher.js', filters='yui_js', output='out/tambur_pub.min.js')
    env.register('tambur.js', tamburjs)
    env.register('tambur.min.js', tamburminjs)
    env.register('tambur_pub.js', publishjs)
    env.register('tambur_pub.min.js', publishminjs)
    cmdenv = CommandLineEnvironment(env, log)
    cmdenv.build()
开发者ID:tamburio,项目名称:tambur.js,代码行数:31,代码来源:assets.py

示例5: build_assets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def build_assets(mod):
    from webassets.script import CommandLineEnvironment

    module = import_module(mod, True)
    assets_env = module.app.jinja_env.assets_environment

    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.build()
开发者ID:mardix,项目名称:flask-magic,代码行数:14,代码来源:cli.py

示例6: _buildassets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def _buildassets(app):

    from webassets.script import CommandLineEnvironment

    module = get_app_serve_module(app)
    assets_env = module.app.jinja_env.assets_environment

    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.build()
开发者ID:mardix,项目名称:webportfolio,代码行数:15,代码来源:cli.py

示例7: static

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def static(path, input):
    '''Compile and collect static files'''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.build()

    if exists(path):
        print('"{0}" directory already exists and will be erased'.format(path))
        if input and not prompt_bool('Are you sure'):
            exit(-1)
        shutil.rmtree(path)

    print('Copying assets into "{0}"'.format(path))
    shutil.copytree(assets.directory, path)

    print('Done')
开发者ID:pborreli,项目名称:cada,代码行数:21,代码来源:commands.py

示例8: static

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def static(path, no_input):
    '''Compile and collect static files into path'''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.build()

    if exists(path):
        warning('{0} directory already exists and will be {1}', white(path), white('erased'))
        if not no_input and not click.confirm('Are you sure'):
            exit_with_error()
        shutil.rmtree(path)

    echo('Copying assets into {0}', white(path))
    shutil.copytree(assets.directory, path)

    success('Done')
开发者ID:etalab,项目名称:cada,代码行数:21,代码来源:commands.py

示例9: build

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def build():
    '''Compile static files'''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    # Override some local config
    current_app.config['DEBUG'] = False
    current_app.config['ASSETS_DEBUG'] = False
    current_app.config['REQUIREJS_RUN_IN_DEBUG'] = True

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.build(production=True)

    print('Performing require.js optimization')
    buildfile = join(assets.directory, 'js', 'app.build.js')
    # bust = 'pragmas.bust={0}'.format(time.time())
    params = ['r.js', '-o', buildfile]
    subprocess.call(params)

    print('Done')
开发者ID:pombredanne,项目名称:udata,代码行数:23,代码来源:static.py

示例10: main

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
def main():
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    env = Environment('.', '/static')
    jsonjs = Bundle(
            'deps/json2.js', filters='yui_js', output='out/json2.min.js')
    sockjs = Bundle(
            'deps/web_socket.js', filters='yui_js', output='out/web_socket.min.js')
    tamburjs = Bundle(
            'deps/swfobject.js',
            'src/tambur_comet_fallback.js',
            'src/tambur_connection.js',
            'src/tambur_logger.js',
            'src/tambur_utils.js',
            'src/tambur_stream.js', output='out/tambur.js')
    tamburminjs = Bundle(
            'deps/swfobject.js',
            'src/tambur_comet_fallback.js',
            'src/tambur_connection.js',
            'src/tambur_logger.js',
            'src/tambur_utils.js',
            'src/tambur_stream.js', filters='yui_js', output='out/tambur.min.js')
    publishjs = Bundle(
            'deps/sha1.js',
            'deps/oauth.js',
            'src/tambur_publisher.js', output='out/tambur_pub.js')
    publishminjs = Bundle(
            'deps/sha1.js',
            'deps/oauth.js',
            'src/tambur_publisher.js', filters='yui_js', output='out/tambur_pub.min.js')
    env.register('tambur.js', tamburjs)
    env.register('tambur.min.js', tamburminjs)
    env.register('tambur_pub.js', publishjs)
    env.register('tambur_pub.min.js', publishminjs)
    env.register('json2.js', jsonjs)
    env.register('web_socket.js', sockjs)
    cmdenv = CommandLineEnvironment(env, log)
    cmdenv.build()
开发者ID:slavah,项目名称:tambur.js,代码行数:42,代码来源:assets.py

示例11: _init_webassets

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [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

示例12: run

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
  def run(self):
    from webassets import Bundle
    from webassets import Environment
    from webassets.script import CommandLineEnvironment

    css = Bundle('curious/src/css/app.css', output='curious/dist/curious.css')
    js = Bundle('curious/src/js/*.js', output='curious/dist/curious.js')
    jsmin = Bundle('curious/src/js/*.js', filters='jsmin', output='curious/dist/curious.min.js')
    jst = Bundle('curious/src/html/*.html', filters='jst', output='curious/dist/curious_jst.js')

    assets_env = Environment('./curious/static')
    assets_env.cache = self.cache_dir
    assets_env.register('css', css)
    assets_env.register('js', js)
    assets_env.register('jsmin', jsmin)
    assets_env.register('jst', jst)

    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets_env, log)
    cmdenv.build()
开发者ID:benjiec,项目名称:curious,代码行数:25,代码来源:setup.py

示例13: bundle

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [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

示例14: in

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
import logging
from os import makedirs, path

from webassets.script import CommandLineEnvironment
from cunhajacaiu import assets
from cunhajacaiu.settings import STATIC_PATH

for dir in ('css', 'js'):
    makedirs(path.join(path.abspath(STATIC_PATH), dir), exist_ok=True)

log = logging.getLogger('webassets')
log.addHandler(logging.StreamHandler())
log.setLevel(logging.DEBUG)

cli = CommandLineEnvironment(assets, log)
cli.build()
开发者ID:cuducos,项目名称:cunhajacaiu,代码行数:18,代码来源:assets.py

示例15: Environment

# 需要导入模块: from webassets.script import CommandLineEnvironment [as 别名]
# 或者: from webassets.script.CommandLineEnvironment import build [as 别名]
import logging

from webassets import Environment
from webassets import Bundle
from webassets.script import CommandLineEnvironment

# Bundle and minify the javascript
# Since Flask isn't serving the JS this needs to be done here
# before the static files are pulled down on nginx
# Kind of not the way I was hoping to handle this

log = logging.getLogger('webassets')
log.addHandler(logging.StreamHandler())
log.setLevel(logging.DEBUG)

env = Environment('mojibake/static', '/static')
js = Bundle('js/jquery.min.js',
            'js/jquery-ui.custom.js',
            'js/skel.min.js',
            'js/skel-panels.min.js',
            'js/init.js',
            'js/mojibake.js',
            filters='jsmin',
            output='js/packed.js')
env.register('js_all', js)

# From the docs
# https://webassets.readthedocs.org/en/latest/script.html
cmdenv = CommandLineEnvironment(env, log)
cmdenv.build()
开发者ID:ardinor,项目名称:mojibake,代码行数:32,代码来源:pack_js.py


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