本文整理汇总了Python中webassets.Environment.auto_build方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.auto_build方法的具体用法?Python Environment.auto_build怎么用?Python Environment.auto_build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webassets.Environment
的用法示例。
在下文中一共展示了Environment.auto_build方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_webassets_env
# 需要导入模块: from webassets import Environment [as 别名]
# 或者: from webassets.Environment import auto_build [as 别名]
def get_webassets_env(conf):
'''Get a preconfigured WebAssets environment'''
# Configure webassets
assets_environment = AssetsEnvironment(conf.get('static_files_dir', DEFAULT_STATIC), '/')
assets_environment.debug = conf.get('debug', False)
assets_environment.auto_build = conf.get('debug', False)
assets_environment.config['less_paths'] = (
'bower/bootstrap/less',
'bower/etalab-assets/less',
'bower/bootstrap-markdown/less',
)
# Load bundle from yaml file
loader = YAMLLoader(resource_stream(__name__, '../assets.yaml'))
bundles = loader.load_bundles()
for name, bundle in bundles.items():
assets_environment.register(name, bundle)
return assets_environment
示例2: Environment
# 需要导入模块: from webassets import Environment [as 别名]
# 或者: from webassets.Environment import auto_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()
示例3: WAEnvironment
# 需要导入模块: from webassets import Environment [as 别名]
# 或者: from webassets.Environment import auto_build [as 别名]
AUTH_USER_MODEL = 'UserModel'
AUTH_USER_COLLECTION = 'accounts'
# --// Web Assets settings \\--
# Put import here to avoid losing data in recursive import
import assets
ASSETS = WAEnvironment(STATIC_ROOT, '/static')
# Make sure you've install sass
# $ sudo apt-get install ruby
# $ sudo gem install sass
ASSETS.config['SASS_BIN'] = '/usr/local/bin/sass'
for k, v in assets.bundles.iteritems():
ASSETS.register(k, v)
if DEBUG:
ASSETS.auto_build = True
# See PEP 391 and logconfig for formatting help.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'main_formatter': {
'format': '%(levelname)s:%(name)s: %(message)s '
'(%(asctime)s; %(filename)s:%(lineno)d)',
'datefmt': "%Y-%m-%d %H:%M:%S",
},
'console_formatter': {
'format': '%(message)s',
},
示例4: Environment
# 需要导入模块: from webassets import Environment [as 别名]
# 或者: from webassets.Environment import auto_build [as 别名]
import os
from werkzeug.wrappers import Request, Response
from werkzeug.wsgi import SharedDataMiddleware
from webassets import Environment, Bundle, ExternalAssets
environment = Environment('static', '/static')
environment.versions = 'hash'
manifest_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '.static-manifest'))
environment.manifest = 'file://%s' % manifest_path
environment.cache = False
environment.auto_build = True
environment.url = '//0.0.0.0:5001/static/'
#environment.debug = True
#less = Bundle('less/main.less', filters='less', output='gencss/less.css')
css = Bundle(
Bundle('less/main.less', filters='less', output='gencss/less.css'),
'css/main.css',
'css/sub/sub-main.css',
filters='cssrewrite',
output='gencss/css-merged.%(version)s.css'
)
external_solo = ExternalAssets('map.png')
external_main = ExternalAssets(
'css/img/*',