Using less-rails-bootstrap with Jammit
-
17-06-2021 - |
문제
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.
올바른 솔루션이 없습니다
다른 팁
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.