css gpu加速_五个CSS性能工具可加速您的网站

news/2024/5/20 2:31:59/文章来源:https://blog.csdn.net/culi3118/article/details/108375598

css gpu加速

CSS Minification Tools

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。

In this article, I’m going to list five CSS performance tools that will help you put your website on a CSS diet for a fast loading experience.

在本文中,我将列出五个CSS性能工具,这些工具将帮助您将网站置于CSS饮食上,以实现快速加载体验。

为什么页面速度如此重要? (Why Is Page Speed so Important?)

A fast loading website is crucial to the success of your website. There are research findings to support the view that users get quickly impatient if they have to wait even a few seconds for web content to appear.

快速加载的网站对于您网站的成功至关重要。 有一些研究发现支持以下观点:用户即使要等待几秒钟才能显示Web内容,也会很快变得不耐烦。

When this happens on your website, their experience degrades noticeably with the consequence that your website gets fewer visits and fewer conversions, which ends up hurting your business.

当这种情况在您的网站上发生时,他们的体验会明显下降,结果是您的网站访问量和转换次数减少,最终损害了您的业务。

There are a number of factors that affect web performance, e.g., the number of HTTP requests, bloated code, heavy media files, etc. How you write CSS and how your stylesheet gets loaded in the browser can have significant impact on a few of those precious milliseconds which make the difference between visitors staying on your website and clicking their way toward your competition.

有许多因素会影响Web性能,例如HTTP请求的数量,code肿的代码,大量的媒体文件等。如何编写CSS以及如何将样式表加载到浏览器中会对其中的一些因素产生重大影响宝贵的毫秒数,这使访问者停留在您的网站上与点击进入竞争的方式有所不同。

Let’s see how the tools below can help to fix your CSS for top-notch web performance.

让我们看看下面的工具如何帮助您修复CSS,以实现一流的Web性能。

TestMyCSS (TestMyCSS)

CSS performance tools: TestMyCSS

TestMyCSS is a free online optimization tool with tons of features. It checks for redundancy, validation errors, unused CSS, and best practices.

TestMyCSS是具有大量功能的免费在线优化工具。 它检查冗余验证错误未使用CSS最佳实践

You can start to use it right away, just type the url to a website’s CSS file, and TestMyCSS spits out all the items that need improvement. Not only that, you can also find helpful hints on

您可以立即开始使用它,只需键入网站CSS文件的url,TestMyCSS就会吐出所有需要改进的项目。 不仅如此,您还可以在以下方面找到有用的提示

  • How to simplify complex selectors

    如何简化复杂的选择器
  • Duplicated CSS properties and selectors you need to get rid of

    您需要摆脱的重复CSS属性和选择器
  • The number of !important declarations present in the code

    代码中存在的!important声明的数量

  • Unecessary class specificity

    不必要的班级特异性
  • Unecessary IE fixes

    不必要的IE修复
  • Prefixed CSS properties which don’t need vendor prefixes any more

    不需要供应商前缀的前缀CSS属性
  • Class or ID rules qualified with tag names, e.g., a.primary-link

    具有标签名称的类或ID规则,例如a.primary-link

  • Inappropriate use of universal selectors.

    通用选择器使用不当。

Stylelint (Stylelint)

CSS performance tools: Stylelint

Stylelint is an ambitious CSS linter that works with PostCSS, an open source tool to write state of the art CSS. A linter is a program that goes through your code and catches any potential errors.

Stylelint是一个雄心勃勃CSS小工具,可与PostCSS一起使用 , PostCSS是一种用于编写最新CSS的开源工具。 linter是一个程序,它遍历您的代码并捕获任何潜在的错误。

Stylelint can

Stylelint可以

  • Flag errors like typos, invalid hex colors, duplicate selectors, etc.

    标记错误,例如错别字,无效的十六进制颜色,重复的选择器等。
  • Enforce best practices

    实施最佳做法
  • Enforce coding style conventions like consistent spacing in each CSS rule, etc.

    在每个CSS规则中强制执行编码样式约定,例如一致的间距等。
  • Provide support for new cutting edge CSS syntax

    提供对新的尖端CSS语法的支持
  • Automatically fix some minor warnings using stylefmt, a tool to format CSS rules …

    使用stylefmt (一种用于格式化CSS规则的工具)自动修复一些次要警告…

… and more.

… 和更多。

Stylelint is very versatile, you can use it with

Stylelint非常通用,您可以将其与

  • The Stylelint CLI (Command Line Interface)

    Stylelint CLI(命令行界面)
  • A plugin for your build tool of choice, e.g., webpack, gulp, etc.

    用于您选择的构建工具的插件,例如,webpack,gulp等。
  • A plugin for your text editor of choice, e.g., Atom, Sublime Text, etc.

    可供您选择的文本编辑器的插件,例如Atom,Sublime Text等。
  • The Stylelint Node API

    Stylelint节点API
  • The Stylelint PostCSS plugin.

    Stylelint PostCSS插件。

You can find more details on how to get started in the Stylelint User Guide and the Developer Guide.

您可以在《 Stylelint 用户指南》和《 开发人员指南》中找到有关如何入门的更多详细信息。

CSS触发器 (CSS Triggers)

CSS performance tools: CssTriggers

CSS Triggers is an online resource that informs you of which CSS properties cause layout, paint and composite operations in which browsers. These are processes the browser performs when rendering a webpage.

CSS触发器是一个在线资源,可通知您哪些CSS属性会导致在哪些浏览器中进行布局,绘制和复合操作。 这些是浏览器在渲染网页时执行的过程。

In particular:

特别是:

  • Layout: the browser generates the geometry and position of each element

    布局 :浏览器生成每个元素的几何形状和位置

  • Paint: the browser resolves the pixels for each element into layers

    画图 :浏览器将每个元素的像素分解为图层

  • Composite: the browser draws the layers on the screen.

    复合 :浏览器在屏幕上绘制图层。

This information is especially precious if you animate elements on the web. Composite operations are the cheapest for the browser to perform. If your CSS code animates properties which repeatedly trigger layout and paint operations, it’ll be hard to stick to 60fps (frames per second), a crucial number for smooth web animations.

如果您对网络上的元素进行动画处理,则此信息特别宝贵。 对于浏览器而言,复合操作最便宜。 如果您CSS代码对反复触发布局和绘画操作的属性进行动画处理,则很难保持60fps(每秒帧数)的速度,这对于平滑Web动画来说是至关重要的数字。

csnano (cssnano)

CSS performance tools: cssnano

Using a lean and well-structured stylesheet document becomes important when you think that CSS is on the critical path to the page rendering process. In other words, by default browsers delay the rendering of a web page until the stylesheets are loaded, parsed and executed. Therefore, if your CSS document is large and messy, visitors are more likely to have to wait a bit before being able to consume content on your website.

当您认为CSS处于页面呈现过程的关键路径上时,使用精简且结构良好的样式表文档就变得很重要。 换句话说,默认情况下,浏览器会延迟网页的呈现,直到加载,解析和执行样式表为止。 因此,如果您CSS文档又大又杂乱,则访问者更有可能需要稍等片刻才能使用您网站上的内容。

cssnano is a CSS optimization and minification plugin for PostCSS. In particular,

cssnano是一个CSS优化和微小插件PostCSS 。 特别是,

cssnano takes your nicely formatted CSS and runs it through many focused optimisations, to ensure that the final result is as small as possible for a production environment.

cssnano会采用格式良好CSS并通过许多有针对性的优化来运行它,以确保最终结果对于生产环境而言尽可能小。

This tool has tons of features, to find out all the things it can do for you, head over to the cssnano website.

该工具具有大量功能,以查找它可以为您做的所有事情,请访问cssnano网站。

危急 (Critical)

CSS performance tools: Critical

Critical is another tool for tackling the critical path issue with CSS I mentioned in the previous section.

关键是我在上一节中提到的使用CSS解决关键路径问题的另一种工具。

Among PageSpeed Insights‘s rules and recommendations you’ll find this tip:

在PageSpeed Insights的规则和建议中,您会发现以下提示:

For best performance, you may want to consider inlining the critical CSS directly into the HTML document. This eliminates additional roundtrips in the critical path …

为了获得最佳性能,您可能需要考虑将关键CSS直接内联到HTML文档中。 这消除了关键路径中的其他往返行程。

Ilya Grigorik on the Google Developers Blog.

Google开发者博客上的Ilya Grigorik。

The idea is to look for critical CSS rules and place those rules in the <head> section of your HTML document. As to what you can consider critical CSS, the general agreement is that any rules used to style basic layout and typography as well as the above-the-fold content of your website are good candidates.

这个想法是寻找关键CSS规则,并将这些规则放在HTML文档的<head>部分中。 关于可以考虑的关键CSS ,普遍同意的是,用于设置基本布局和字体样式的任何规则以及网站的首屏内容都是不错的选择。

Critical generates and inlines critical path CSS for you and you can use it with both Grunt and Gulp. For a detailed tutorial on inlining your critical CSS using this tool, don’t miss Asha Laxmi’s How and Why You Should Inline Your Critical CSS.

关键为您生成并内嵌关键路径CSS,您可以将其与Grunt和Gulp一起使用。 有关使用此工具内联关键CSS的详细教程,请不要错过Asha Laxmi的“ 如何以及为什么应该内联关键CSS” 。

结论 (Conclusion)

In this article, I’ve stressed the importance of a fast-loading website and how a bloated stylesheet means your visitors could face an undesired wait for content to appear on their screens. The five tools I have listed here will make your stylesheets leaner, less bug-prone, and therefore easier for browsers to load and parse.

在本文中,我强调了快速加载网站的重要性,以及过分的样式表如何意味着访问者可能会面临不希望的等待内容出现在屏幕上的等待。 我在此处列出的五种工具将使您的样式表更精简,更不易出现错误,从而使浏览器更易于加载和解析。

What do you use to keep CSS bloat under control? Let me know in the comments below.

您使用什么来控制CSS膨胀? 在下面的评论中让我知道。

翻译自: https://www.sitepoint.com/five-css-performance-tools-speed-website/

css gpu加速

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_785183.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php网站开发架构_PHP的干净代码架构和测试驱动开发

php网站开发架构The Clean Code Architecture was introduced by Robert C. Martin on the 8light blog. The idea was to create an architecture which is independent of any external agency. Your business logic should not be coupled to a framework, a database, or t…

小型企业服务器选择_小型企业的最佳免费和廉价网站选择

小型企业服务器选择Not long ago, if you wanted a website, you had to be willing to shell out at least a few grand for the most basic of static sites. I remember about ten years ago at a firm I worked for, quotes for ecommerce sites, or sites with other dyna…

cms数据库设计_使用Statamic CMS构建无数据库的网站

cms数据库设计A content management system (CMS) is a package of code around which you build a dynamic website—with components that change, adapt and update automatically, in contrast to a hard-coded, static site. 内容管理系统(CMS)是一揽子代码&#xff0c;您…

编辑器生成静态网页_使用静态网站生成器的7个理由

编辑器生成静态网页Static site generators have become increasingly popular and, if my prediction is correct, usage will explode during 2016. Let’s establish what we mean by the term “static site generator” … 静态站点生成器已变得越来越流行&#xff0c;如果…

wordpress 自定义_为您的WordPress网站设计自定义主页

wordpress 自定义WordPress is used on a large portion of sites on the web. It allows us to create a variety of different types of sites, but one of the most important components of any website is always the home page. The perfect landing page will help you …

编辑器生成静态网页_不使用静态网站生成器的7个理由

编辑器生成静态网页Trending posts on SitePoint today: 今天在SitePoint上的热门帖子&#xff1a; 7 Ways to Make WordPress Simpler for Users 为用户简化WordPress的7种方法 I Need a Website. What Do I Need to Know About Hosting? 我需要一个网站。 关于托管我需要了…

wordpress插件_审查的顶级WordPress SEO插件

wordpress插件WordPress provides great native SEO features, so might your theme. However, by using a dedicated SEO plugin (and knowing how to use it) we can further optimize our site. In this article we compare the top SEO plugins for WordPress side-by-side…

如何安装和使用WP-CLI来管理WordPress网站

Speeding up your work process should be one of your top priorities. Simply put, if you do more work in less time, then you will have more time to work on more projects, study and rest. 加快工作流程应该是您的首要任务之一。 简而言之&#xff0c;如果您用更少的…

wordpress快速建站_快速提示:使用WordPress联络表7增强选择加入

wordpress快速建站You might have heard the saying, “the money is in the list”. Your email list, to be exact. Email marketing is widely considered to be the most powerful form of marketing today, and there are plenty of stats to back it up. 您可能已经听说过…

php网站功能块学习_学习PHP 7,了解新功能等

php网站功能块学习PHP 7, the next version of the world’s most popular programming language, has been released. We’d love to shoot fireworks and get drunk with our newfound power (seriously, the language is in the true big leagues now, functionality and pe…

wordpress网站迁移_如何将您的WordPress网站迁移到新的托管服务提供商

wordpress网站迁移This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 We’ve be…

wordpress 静态化_地理定位WordPress内容以个性化您的网站

wordpress 静态化So what does that phrase mean, “Geo-Targeting WordPress Content”? First, let’s back up and look at an example of personalization. 那么&#xff0c;这句话是什么意思&#xff0c;“以地理定位的WordPress内容”&#xff1f; 首先&#xff0c;让我…

next主题seo优化_SEO可见性的5个最佳WordPress主题

next主题seo优化This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 Theme selec…

cloudflare_使用Cloudflare使您的网站更快,更安全

cloudflareCloudflare is an industry leader in the content-delivery space, reducing load and speeding up millions of websites. Cloudflare是内容交付领域的行业领导者&#xff0c;可减轻负载并加快数百万个网站的速度。 What is peculiar about this provider is that…

六个最受欢迎的 CMS 建站系统,不容错过|Gitee项目推荐

CMS 是 Content Management System 的缩写&#xff0c;意为"内容管理系统"。 内容管理系统是企业信息化建设和电子政务的新宠&#xff0c;也是一个相对较新的市场。对于内容管理&#xff0c;业界还没有一个统一的定义&#xff0c;不同的机构有不同的理解。CMS 在各行…

html 相对路径 网站根目录,html中的绝对路径URL和相对路径URL及子目录、父目录、根目录...

绝对URL用于表示Internet中特定文件所需要的全部内容&#xff0c;Internet中的每一个文件都有一个唯一的URL&#xff0c;这就是在网页中搜索时需要输入到地址栏的连接。例如&#xff0c;要进入百度一下的网页&#xff0c;则在网页地址栏中输入&#xff1a;即可。一旦进入到某个…

php网站整合ck播放器,网页视频播放器-ckplayer 整合到wordpress

在这里我将教大家怎样将这款播放器整合到wordpress中来&#xff0c;并教大家怎么将优酷视频用到这款播放器上面!第一步&#xff1a;我们要下载一个播放器文件第二步&#xff1a;将下载文件解压出来&#xff0c;打开里面player文件夹下ckplayer.txt文本文档&#xff0c;将里面的…

【最新】某素材网站上的虎年高质量海报素材合集,附带源文件和预览图

原格式PSD提供给大家同时提供jpg预览图&#xff0c;马上过年了&#xff0c;这套素材用的上&#xff0c;红色喜庆 醉了&#xff0c;本来想整理的上传的&#xff0c;但是发现有水印&#xff0c;现在水印已经全部去除&#xff0c;放心食用&#xff0c;每个图都比较大&#xff0c;一…

使用SSM重新开发计科院网站

一、游览 在游览器地址栏输入&#xff1a;http://localhost:8080/index&#xff0c;即访问计科院首页&#xff0c;由于前期对数据库以及JavaBean的设计考虑不够充分&#xff0c;导致后期的代码臃肿&#xff0c;所以项目启动时对首页进行数据的填充难以实现&#xff0c;必须输入…

airpods固件更新方法_AirPods Pro 固件更新,空间音频来了丨 网站证书更新

09/15 网站证书更新 证书已上传,网站福利应用正在更新中…… 福利区已修复完毕,不知道能活多久! 证书已经上传(回复 证书 获取证书下载链接),证书使用教程查看历史文章 【福利升级】iOS苹果端免越狱 手机端签名神器教程来了! 删掉之前的APP再重新下载即可! 证书很不稳…