- PyPI: https://pypi.org/project/webassets/
- Github: https://github.com/miracle2k/webassets
- Doc: https://webassets.readthedocs.io/
个人感觉是Python版的webpack
安装
pip install webassets
使用示例
from webassets import Environment, Bundle
assets_env = Environment(
directory='./static',
url='/static')
common_js = Bundle(
'js/common-1.js',
'js/common-2.js',
filters='jsmin',
output='js/common.js')
assets_env.register('common_js', common_js)
print(assets_env['common_js'].urls())
# ['/static/js/common.js?207d589d']
assets_env.debug = True
print(assets_env['common_js'].urls())
# ['/static/js/common-1.js', '/static/js/common-2.js']
输入文件
static/js/common-1.js
function foo1() {
}
static/js/common-2.js
function foo2() {
}
输出文件
static/js/common.js
function foo1(){
}
function foo2(){
}
转载:https://blog.csdn.net/mouday/article/details/115696564
查看评论