本文整理汇总了Python中webassets.Bundle.build方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.build方法的具体用法?Python Bundle.build怎么用?Python Bundle.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webassets.Bundle
的用法示例。
在下文中一共展示了Bundle.build方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _bundle_3rd_party_js
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def _bundle_3rd_party_js(env, debug=False):
"""Combine thrid party js libs into libs.js.
For debug, they are left uncompressed. For production the minified
versions are used. We suggest using hte vendor supplied minified version
of each library.
"""
JSPATH = path.join('js', 'lib')
if debug:
all_js = Bundle(
path.join(JSPATH, 'json2.js'),
path.join(JSPATH, 'jquery.js'),
path.join(JSPATH, 'underscore.js'),
path.join(JSPATH, 'backbone.js'),
path.join(JSPATH, 'bootstrap.js'),
path.join(JSPATH, 'leaflet.js'),
path.join(JSPATH, 'bootstrap-typeahead-improved.js'),
output=path.join('..', 'static', 'script', 'libs.js')
)
else:
JSPATH = path.join(JSPATH, 'min')
all_js = Bundle(
path.join(JSPATH, 'json2.min.js'),
path.join(JSPATH, 'jquery-min.js'),
path.join(JSPATH, 'underscore-min.js'),
path.join(JSPATH, 'backbone-min.js'),
path.join(JSPATH, 'bootstrap-min.js'),
path.join(JSPATH, 'leaflet-min.js'),
path.join(JSPATH, 'bootstrap-typeahead-improved-min.js'),
output=path.join('..', 'static', 'script', 'libs.js')
)
env.add(all_js)
if debug:
all_js.build()
示例2: _bundle_3rd_party_js
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def _bundle_3rd_party_js(app, env, debug=False):
"""Combine thrid party js libs into libs.js.
For debug, they are left uncompressed. For production the minified
versions are used. We suggest using hte vendor supplied minified version
of each library.
"""
JSPATH = path.join('js', 'lib')
if debug:
scripts = ()
if not scripts:
return
all_js = Bundle(
*scripts,
output=path.join('..', '..', app, 'static', 'script', 'libs.js')
)
else:
JSPATH = path.join(JSPATH, 'min')
scripts = ()
if not scripts:
return
all_js = Bundle(
*scripts,
output=path.join('..', '..', app, 'static', 'script', 'libs.js')
)
env.add(all_js)
if debug:
all_js.build()
示例3: test
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def test(self):
bundle = Bundle("one.css", "two.css", output="styles.css")
assets_env = create_assets_env(
source_dir="./tests/fixtures/bundle", build_dir=self.build_dir, static_url="/", bundles={}
)
bundle.build(env=assets_env)
self.assertTrue("styles.css" in os.listdir(self.build_dir))
示例4: register_tpl_bundle
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def register_tpl_bundle(self, name, *files):
def noop(_in, out, **kw):
out.write(_in.read())
bundle = Bundle(*files, filters=(noop,), output='tpls/{}'.format(name))
fileName = bundle.resolve_output(self.assets)
if os.path.isfile(fileName):
os.remove(fileName)
bundle.build(self.assets,force=False,disable_cache=True)
self.assets.register(name, bundle)
示例5: create_and_register_bundles
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def create_and_register_bundles(section, filter, DEPLOY):
environment = Environment('.')
for option in config.options(section):
deps = [v.strip() for v in config.get(section, option).split(',')]
log.info("%s.%s has dependencies: %s", option, section, deps)
bndl = Bundle(*deps, filters=filter,
output=concat_string([DEPLOY, '/', option, '.', section]))
environment.register(option, bndl)
bndlgz = Bundle(*deps, filters=concat_string([filter, ', gzip']),
output=concat_string([DEPLOY, '/', option, '.', section, '.gz']))
environment.register(concat_string([option, 'gz']), bndlgz)
bndl.build()
bndlgz.build()
示例6: Environment
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
#!/usr/bin/env python
from os import path
from webassets import Bundle, Environment
env = Environment(path.join(path.dirname(__file__), 'static'), '/stylesheets')
# App Engine doesn't support automatic rebuilding.
env.auto_build = False
# This file needs to be shipped with your code.
env.manifest = 'file'
bundle = Bundle('in.css', filters="cssmin", output="out.css")
env.add(bundle)
if __name__== "__main__":
# If this file is called directly, do a manual build.
bundle.build()
示例7: test_output
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def test_output(self):
environment = Environment(path.dirname(__file__))
bundle = Bundle('input.jsx', output='input.js', filters=('react',))
environment.register('test_bundle', bundle)
bundle.build()
示例8: test
# 需要导入模块: from webassets import Bundle [as 别名]
# 或者: from webassets.Bundle import build [as 别名]
def test(self):
bundle = Bundle('one.css', 'two.css', output='styles.css')
assets_env = create_assets_env('./tests/fixtures/bundle', self.build_dir, {})
bundle.build(env=assets_env)
self.assertTrue('styles.css' in os.listdir(self.build_dir))