bootstrap admin theme 配合 flask 的正确打开方式是什么?

2018-08-09 10:11:18 +08:00
 4ever911
对 web 不熟,需要做一个简单好看的后台信息展示小工具,找了几个好看的模版,目前我的方式是:

1. 先在购买的 theme 的基础上搭建一个范例文件,组合出我需要的一些 ui 元素和页面布局

2. 因为会有很多用不到的 js 和 css,这一步需要一条一条删除然后刷新页面看是否有影响,然后最终保存一个相对简洁的文件。

3. 拷贝到 flask 中做模版,又需要修改资源路径,js css 等


4.jinja 替换 ui 元素信息为我要的信息


赶觉这样操作好浪费时间。



所以,我的问题是:
1. 是不是我这种使用 bootstrap admin theme 结合 flask 的方式不对?

2. 有没有方法针对某一个页面,仅仅只另存为用到加载到的资源。比如随便一个 bootstrap theme 里面就有大量图片和 js font 都用不到,能怎么保存一个精简版?

听说 react 做 ui 爽,我简单看了下,学习起来要费时间,我目前主要只是要一个好看的 admin 加上一些 ajaxj 动态刷新就足够。
1536 次点击
所在节点    Python
2 条回复
hiwljun
2018-08-09 10:19:01 +08:00
adminlte 了解一下。

<!-- Tell the browser to be responsive to screen width -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/bootstrap/css/bootstrap.min.css') }}">

<!-- Font Awesome -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/font-awesome/css/font-awesome.min.css') }}">

<!-- Ionicons -->
<link rel="stylesheet" href="{{ url_for('static', filename='plugins/Ionicons/css/ionicons.min.css') }}">

<!-- Theme style -->
<link rel="stylesheet" href="{{ url_for('static', filename='css/AdminLTE.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/skin-blue.min.css') }}">

<!-- jQuery 3 -->
<script src="{{ url_for('static', filename='plugins/jquery/jquery.min.js') }}"></script>

<!-- Bootstrap 3.3.7 -->
<script src="{{ url_for('static', filename='plugins/bootstrap/js/bootstrap.min.js') }}"></script>

<!-- AdminLTE App -->
<script src="{{ url_for('static', filename='js/adminlte.min.js') }}"></script>
scukmh
2018-08-09 10:25:21 +08:00
干嘛搞那么麻烦,nginx static 做一个,api 做一个,不要用 flask 的模板。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/478149

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX