Fewer documents says:
Use @import (inline) to include external files, but not to process them.
See Import At-Rules and @import (inline)
You can create a new file, for example concatenate.less and import the .less files with the inline . Then, if you process it, it will work just like concatenation, CSS will not be processed from it.
concatenate.less
@import (inline) "file1.less" @import (inline) "file2.less" @import (inline) "file3.less"
And use the Grunt task, as you did, just for clarity, rename the output file extension to .less . Tested, should give you exactly what you wanted.
Nested Import
As @ seven-phase-max noted, in this case, the problem will be related to nested imports.
The decision will be grouchy - includes .
- Use
grunt-includes with the includeRegexp option to create the files listed in concatenate.less , with the already imported LESS files in some other folder. - Change the paths of the
concatenate.less files to this folder. - Start your LESS compilation of the Grunt task as usual.
source share