静态资源 : CSS
所有的CSS文件进行预处理、级联、精缩、压缩和缓存(服务器端和浏览器端)。结果:
- 重新载入页面时, CSS文件仅加载一次
- 这个CSS文件共享并缓存其间的页面, 这样, 当访问者点击另一页上, 浏览器甚至不需要加载一个CSS资源。
- CSS文件被优化到更小
: The CSS used by Odoo is . a theme might use , most of Odoo and . Since Odoo Less and Sass, you can CSS rules of them extra CSS lines, in a file.
: every or you might use in Odoo has its own set of CSS, Less or Sass files (, blogs, , etc.). CSS files is great for the , but not good for the most can only 6 in in lots of files in . The time to a file is much than the data time, for small files like .JS and .CSS. Thus, the time to load CSS more on the of to be done than the file size.
为了解决这个问题,所有的CSS / Less / Sass文件合并为一个.CSS文件发送至浏览器。因此一位访客每页 只需要加载一个.css文件 ,这是特别有效的。由于CSS是在所有页面共享的,当访问者点击另一页上,浏览器甚至无需加载新的CSS文件!
Both files in the <head> | What the gets (only one file) |
---|---|
/* From .css * / | . { |
. { | color: #666; |
color: #777; | : |
: ; | } |
} | |
/* From .css * / | |
. { | |
color: #666; | |
} |
Odoo发送的CSS包括所有CSS/Less/Saas /模块。这样,用户不需要下载CSS文件就可浏览更多的页面。但一些模块可能包含巨大的CSS/资源,因为太大, 可以不用放在第一页。在这种情况下,Odoo将资源转化为二部分,只加载页面时使用。举个例子, 只有当访问者登录并访问后端(/web)时才加载的后台程序。
: After being and , the CSS is to its size.
After | |
---|---|
/* some * / | . {color: #666} |
. { | |
color: #666; | |
} |
然后将最终结果压缩,然后再传递给浏览器。
然后,缓存版本存储在服务器端(所以我们无需对每个请求预先处理、级联、精缩)和浏览器端(所以同一名访问者只需加载一次其访问的所有页面)。