Remove unused javascript and css components #443

Closed
ragrawal opened this Issue Nov 10, 2012 · 3 comments

Comments

Projects
None yet
4 participants

Hi,

In order to improve the performance of my website, I am trying to reduce the size of the javascript and css. Currently I am not using most of the javascript component and wondering how I can tell twitter-bootstrap-rails to skip those component.

ippa commented Nov 11, 2012

I need this too. For example, in one project I just want the carousel-javascript. I've tried variations on "require twitter/bootstrap" but couldn't find a working one.

Contributor

caarlos0 commented Nov 13, 2012

It's more for a question than a bug, anyway, I'll help you guys.

In my app, I do it like this:

application.js.coffee:

#= require jquery
#= require jquery_ujs
#= require twitter/bootstrap/bootstrap-transition
#= require twitter/bootstrap/bootstrap-alert
#= require twitter/bootstrap/bootstrap-modal
#= require twitter/bootstrap/bootstrap-button
#= require twitter/bootstrap/bootstrap-collapse

bootstrap_and_overrides.less:

@import "twitter/bootstrap/reset.less";
@import "twitter/bootstrap/variables.less";
@import "twitter/bootstrap/mixins.less";
@import "twitter/bootstrap/scaffolding.less";
@import "twitter/bootstrap/grid.less";
@import "twitter/bootstrap/layouts.less";
@import "twitter/bootstrap/type.less";
@import "twitter/bootstrap/forms.less";
@import "twitter/bootstrap/wells.less";
@import "twitter/bootstrap/component-animations.less";
@import "twitter/bootstrap/buttons.less";
@import "twitter/bootstrap/close.less";
@import "twitter/bootstrap/navs.less";
@import "twitter/bootstrap/navbar.less";
@import "twitter/bootstrap/labels-badges.less";
@import "twitter/bootstrap/hero-unit.less";
@import "twitter/bootstrap/utilities.less";
@import "twitter/bootstrap/responsive";

I think that instead of "skip" what you don't want, you have to add only what you want.
Hope it helps.

@toadkicker toadkicker closed this Apr 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment