madelves
madelves

Reputation: 21

Using less-rails-bootstrap with Jammit

Does anyone have any experience using Jammit and the less-rails-bootstrap gem?

I am developing for a Rails 3.2 app which uses less-rails-bootstrap and wanted to deploy using jammit to minimize requests. I developed using the gem and LESS files which includes @import commands and it doesn't translate well with jammit.

Is there a way for jammit to recognize LESS files and precompile everything @import and then compress everything?

Am new here and I have searched and didn't find anything similar to my problems. If anyone can direct me that'd be awesome.

Upvotes: 2

Views: 171

Answers (1)

Bass Jobsen
Bass Jobsen

Reputation: 49054

You should compile your Less files into CSS before using Jammit.

lessc bootstrap.less > bootstrap.css

To above command already generates a single CSS file for all Bootstrap CSS code. You can use Jammit to combine and compress that bootstrap.css file with your other CSS files.

Notice that the @import directive in Less differs from that in CSS. The @import directive in Less imports the contains of the file in to the main scope to be able to compile it.

Upvotes: 0

Related Questions