Skip to Content
Node与Express开发(第2版)
book

Node与Express开发(第2版)

by Ethan Brown
June 2021
Intermediate to advanced
290 pages
9h 21m
Chinese
Posts & Telecom Press
Content preview from Node与Express开发(第2版)
187
第 17章
静态内容
静态内容
指的是应用提供的那些不会在不同请求之间变化的资源。通常包括以下内容。
多媒体
图片、视频和音频文件。当然,也可能即时生成图片文件(视频和音频也是如此,不过
要少见得多),但是大多数多媒体资源是静态的。
HTML
如果
We
b
应用在使用视图来渲染动态的
HTML
,一般就不能认为是静态
HTML
了(虽
然出于性能考虑,可以动态生成
HTML
,之后缓存它
,并作为静态资源提供)。正如所
见,
S
PA
应用通常是发送单个静态
HTML
文件到客户端,这就是把
HTML
看作静态资
源最常见的原因。注意,要求客户端使用
.html
扩展名是有些过时的做法
,因此现在大
多数服务器允许提供不带扩展名的静态
HTML
资源
(所以
/foo
和
/foo.html
会返回同样
的内容)。
CSS
即使使用的是经过抽象的
CSS
语言
,比如
LESS
、
Sass
或
Stylus
,浏览器最终需要的还
是普通的
CSS
,这是一种静态资源。
1
JavaScript
如果服务器端正在运行
JavaScript
,并不意味着就不能有客户端
JavaScript
。客户端
JavaScript
被
认为是静态资源。当然,现在这个界线开始有些模糊了:要是有一些公共
注
1
:
在浏览器上使用未编译的
LESS
是可能的,但需要一些
JavaScript
“魔法”。而且,这样做对性能有一
些影响,所以我不推荐。
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

面向对象的思考过程(原书第5版)

面向对象的思考过程(原书第5版)

马特 魏斯费尔德
精通模块化JavaScript

精通模块化JavaScript

Nicolás Bevacqua

Publisher Resources

ISBN: 9787115565099