查找未使用的图像、css 规则、js 脚本块

2023-10-02前端开发问题
46

本文介绍了查找未使用的图像、css 规则、js 脚本块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我们有一个相当大的 asp.net 网站.

图像、css 和 javascripts 是网站项目中组织的属性,但随着我们正在改变网站的外观和感觉,我想知道是否有工具/插件可以帮助我识别哪些图像未在网站中使用.

我也想用 css 和 javascript 找到同样的东西.我看过dustme firefox扩展,但只有css.

解决方案

未使用的 CSS

  1. 在 http://www.sitepoint.com 查看 Firefox 扩展 Dust-Me/dustmeselectors/.

  2. Google Chrome 在其开发者控制台中有一个网站审核工具.p>

  3. 我还发现这个站点用于删除未使用的 css - http://unused-css.com/.键入站点的 url,您将获得 CSS 选择器列表.对于每个选择器,一个数字表示一个选择器被使用了多少次.此服务有一些限制.不支持 @import 语句.您无法配置和下载新的干净 CSS 文件.

  4. Helium CSS 是一个 javascript 工具,用于发现跨多个页面的未使用 CSS网站.您首先必须将 javascript 文件安装到要测试的页面.然后,你必须调用一个氦函数来开始清洗.

  5. CSSESS 是一个小书签,可帮助您在任何站点上找到未使用的 CSS 选择器.这个工具很容易使用,但它不会让你配置和下载干净的 CSS 文件.它只会列出未使用的 CSS 文件.

  6. 如何在网站中找到未使用的图像和 CSS 样式?

未使用的图片:

  1. http://obsidience.blogspot.在/2008/06/using-powershell-to-find-unused-images.html
  2. 如何我是否要编写 Bash 脚本来查找项目中未使用的图像?

未使用的 JS:

  1. 查找未使用的 CSSWeb 项目中的规则和 js 脚本?
  2. 查找未使用的 Javascript 函数?

We have a fairly large asp.net website.

The images, css and javascripts are property organized in the website project but as we are changing the look and feel of the website, I would like to know if there is a tool/add-in that will help me identify which images are not being used in the website.

I would like to find the same thing with css and javascript as well. I have looked at dustme firefox extension but that only does css.

解决方案

Unused CSS

  1. Take a look at the Firefox extension Dust-Me at http://www.sitepoint.com/dustmeselectors/.

  2. Google Chrome has a website auditing tool in their developer console.

  3. Also I found this site for removing unused css - http://unused-css.com/ . Type the url of a site and you will get a list of CSS selectors. For each selector, a number indicates how many times a selector is used. This service has a few limitations. The @import statement is not supported. You can't configure and download the new clean CSS file.

  4. Helium CSS is a javascript tool for discovering unused CSS across many pages on a web site. You first have to install the javascript file to the page you want to test. Then, you have to call a helium function to start the cleaning.

  5. CSSESS is a bookmarklet that helps you find unused CSS selectors on any site. This tool is pretty easy to use but it won't let you configure and download clean CSS files. It will only list unused CSS files.

  6. How can I find unused images and CSS styles in a website?

Unused Images:

  1. http://obsidience.blogspot.in/2008/06/using-powershell-to-find-unused-images.html
  2. How Do I Make a Bash Script To Find Unused Images in a Project?

Unused JS:

  1. Find unused CSS rule and js script in a web project?
  2. Find unused Javascript functions?

这篇关于查找未使用的图像、css 规则、js 脚本块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

js删除数组中指定元素的5种方法
在JavaScript中,我们有多种方法可以删除数组中的指定元素。以下给出了5种常见的方法并提供了相应的代码示例: 1.使用splice()方法: let array = [0, 1, 2, 3, 4, 5];let index = array.indexOf(2);if (index -1) { array.splice(index, 1);}// array = [0,...
2024-11-22 前端开发问题
182

layui 单选框、复选框、下拉菜单不显示问题如何解决?
1. 如果是ajax嵌套了 页面, 请确保 只有最外层的页面引入了layui.css 和 layui.js ,内层页面 切记不要再次引入 2. 具体代码如下 layui.use(['form', 'upload'], function(){ var form = layui.form; form.render(); // 加入这一句});...
2024-11-09 前端开发问题
313

layui要如何改变时间日历布局大小?
问题描述 我想改变layui时间日历布局大小,这个要怎么操作呢? 解决办法 可以用css样式对时间日历进行重新布局,具体代码如下: !DOCTYPE htmlhtmlheadmeta charset="UTF-8"title/titlelink rel="stylesheet" href="../../layui/css/layui.css" /style#test-...
2024-10-24 前端开发问题
271

JavaScript小数运算出现多位的解决办法
在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会...
2024-10-18 前端开发问题
301

JavaScript(js)文件字符串中丢失"\"斜线的解决方法
问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转...
2024-10-17 前端开发问题
437

layui中table列表 增加属性 edit="date",不生效怎么办?
如果你想在 layui 的 table 列表中增加 edit=date 属性但不生效,可能是以下问题导致的: 1. 缺少日期组件的初始化 如果想在表格中使用日期组件,需要在页面中引入 layui 的日期组件,并初始化: script type="text/javascript" src="/layui/layui.js"/scrip...
2024-06-11 前端开发问题
455