0

I'm trying to use the gulp-less plugin to compiles bootstrap 2.1.0 less file (yes a very old version) to CSS.

var gulp = require('gulp'),
    less = require('gulp-less');

// Compile Our Less
gulp.task('less', function() {
    return gulp.src('bower_components/bootstrap/less/bootstrap.less')
        .pipe(less().on('error', function(err){
            errorLog(err);
        }))
        .pipe(gulp.dest('compiled-bootstrap-css'));
});

gulp.task('default', ['less']);

function errorLog(err){
    console.log(err);
}

No matter which version I use I see parse errors:

[16:08:01] Starting 'less'...
{ [Error: Missing closing ')' in file d:\Users\trouti\IdeaProject
bower_components\bootstrap\less\mixins.less line no. 552]
  type: 'Parse',
  filename: 'd:\\Users\\trouti\\IdeaProjects\\PublicPortal\\bower
otstrap\\less\\mixins.less',
  index: 17957,
  line: 552,
  callLine: NaN,
  callExtract: undefined,
  column: 8,
  extract:
   [ '    .spanX (@index) when (@index > 0) {',
     '      (~".span@{index}") { .span(@index); }',
     '      .spanX(@index - 1);' ],
  message: 'Missing closing \')\' in file d:\\Users\\trouti\\Idea
cPortal\\bower_components\\bootstrap\\less\\mixins.less line no.
  stack: undefined,
  lineNumber: 552,
  fileName: 'd:\\Users\\trouti\\IdeaProjects\\PublicPortal\\bower
otstrap\\less\\mixins.less',
  name: 'Error',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-less',
  __safety: { toString: [Function] } }

I believe that in order to compile successfully the tool needs to use version 1.3.3 of Less:

http://twitter-bootstrap.1086183.n5.nabble.com/Error-compiling-less-files-v-2-0-4-td788.html

Unfortunately all the available versions of gulp-less build on a later version.

How can I integrate less 1.3.3 into my gulp build?

EDIT: This is not a duplicate of:

LESS: Unrecognized input error when using Bootstrap

because the answer there is to edit the bootstrap.less file. I can't/don't want to do this as I dynamically pull in the bootstrap files at build time using bower. I know I can fix it if I use less 1.3.3 but how can I call in to that from a gulp build when all versions of the gulp-less plugin use a higher version.

Community
  • 1
  • 1
Troup
  • 573
  • 5
  • 17
  • 1
    see http://stackoverflow.com/questions/19553367 – seven-phases-max Sep 03 '15 at 19:53
  • @seven-phases-max thanks for the pointer. I pull in the bootstrap files dynamically at build time using bower. Any suggestions on how I could programmatically make those changes to the .less files during my build? – Troup Sep 04 '15 at 07:48
  • Anyone know of a gulp less plugin that uses less version 1.3.3? All available versions of gulp-less that I can find all use a higher version. – Troup Sep 04 '15 at 07:49
  • I'm afraid you have to apply these changes to your Bootstrap 2 copy in stone (it's not a big deal since BS2 is a few years old and it will never be updated externally anymore). As for `gulp-less` and v1.3.3 - no, since the former is developed a year(s?) after the latter. – seven-phases-max Sep 04 '15 at 09:58

0 Answers0