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

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

问题描述

我的引导程序样式表大小约为120kb。

My bootstrap stylesheet size is around 120kb.

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

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

我不希望跨度课程。我通过在引导自定义页面中对其进行自定义来尝试了此操作。

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

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

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单个额外的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天全站免登陆