2

I've a project with less and CSS files mixed (vendor stuff). I want to optimize all files either CSS or less to one merged CSS file. Usually I've one less file which imports all needed files. But it doesn't work with imported CSS files. It just export the "import "foo.css"" to the merged CSS file.

How can I do that?

messy
  • 915
  • 6
  • 26
  • Duplicate of: http://stackoverflow.com/questions/11196915/import-css-file-into-less-file – donnywals Feb 10 '15 at 11:43
  • @donnywals: sort of. The question is answered by one of the answers at the question you linked to, but as an aside: http://stackoverflow.com/a/22594082/16777 The question itself I think is different enough. – Kev Feb 10 '15 at 11:58

2 Answers2

4

Use @import (inline) directive. You can read more about it here.

aulizko
  • 179
  • 4
1

I suggest to treat .css files imported like they would be .less with the following syntax:

@import (less) "foo.css";

This results in a final compiled .css file that include rows from original .css imported one, followed by processed LESS rows.

Luca Detomi
  • 5,564
  • 7
  • 52
  • 77