我正在努力修改cookiecutter Flask应用。我目前正在尝试添加一个新主题,我从https://bootswatch.com获得了一个名为' spacelab'。我添加了一个新目录' spacelab'然后将2个bootstrap css文件复制并粘贴到其中,如屏幕截图所示。
如果有一个assets.py文件包含:
from flask_assets import Bundle, Environment
# skinning go to https://bootswatch.com/ add to libs/bootstrap/dist/css/
css = Bundle(
"libs/bootstrap/dist/css/spacelab/bootstrap.css",
"css/style.css",
"css/home.css",
# "css/style.css",
filters="cssmin",
output="public/css/common.css"
)
js = Bundle(
"libs/jQuery/dist/jquery.js",
"libs/bootstrap/dist/js/bootstrap.js",
"js/plugins.js",
filters='jsmin',
output="public/js/common.js"
)
assets = Environment()
assets.register("js_all", js)
assets.register("css_all", css)
当我运行它时,我看到:
如果我改变
"libs/bootstrap/dist/css/spacelab/bootstrap.css"
到
"libs/bootstrap/dist/css/dark/bootstrap.css"
例如它正常工作。为什么flask-assets无法正确解析url?
答案 0 :(得分:3)
因为 spacelab 目录中的文件名是 boostrap.css 而不是 bootstrap.css 。 :d