如何从 twitter bootstrap 中删除未使用的样式? [英] How to remove unused styles from twitter bootstrap?

查看:19
本文介绍了如何从 twitter bootstrap 中删除未使用的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的引导样式表大小约为 120kb.

My bootstrap stylesheet size is around 120kb.

但我只使用了 25% 的样式表代码.

But I'm only using 25% of that stylesheet code.

我不想要 span* 类.我通过在引导程序 customize page 中对其进行自定义来尝试它.

I don't want that span* class. I tried it by customizing it in bootstrap customize page.

我未选中网格系统,但我仍然在表单、表格和响应式布局中看到 span1 - span12 class.

I unchecked grid system, But I still see span1 - span12 class in forms, tables and responsive layouts.

有人可以帮我删除这些代码吗?

Can someone help me to remove those codes?

推荐答案

您是否更关心文件大小对用户加载时间的影响?或者想让你更容易阅读/理解更短的 CSS?

Are you more concerned about the impact of the file size on the loading time for your users? Or want to make it easier for you to read/understand the CSS if it's shorter?

无论如何,我建议您不要花太多时间担心删除每一个额外的 CSS 样式.取消选中您不打算使用的 Bootstrap 元素并下载自定义版本.对于网站的实时/生产版本,请使用最小化版本的 CSS,这将进一步减小文件大小.

Either way, I suggest you don't spend too much time worrying about removing every single extra CSS style. Uncheck the elements of Bootstrap that you don't plan on using and download the customized version. For the live/production version of your site, use a minimized version of the CSS which will further reduce the file size.

如果您只是想让代码更简单以供您使用,这绝对可以理解,但 Bootstrap 团队在组织它方面做得非常出色.花一点时间.

If you just want to keep the code more simple for your use, that's definitely understandable but the Bootstrap team has done a great job of organizing it. Spend a little time with it.

考虑到尝试完全删除所有 span* 引用将删除您可能使用的功能,例如控制表单字段的宽度.即使您不使用网格,这些也非常有用.

Consider that trying to completely remove all span* references will remove functionality that you might use like controlling the width of form fields. These can be very useful, even if you're not using the grid.

这篇关于如何从 twitter bootstrap 中删除未使用的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆