0

I would like to use Bootstrap's CDN rather than my local copy. I still have local less files that need to be compiled to CSS though. The issue I'm running into is that some of the variables defined locally were part of Bootstrap so when gulp-less runs it throws an error and halts the process entirely.

Here is the error I'm getting:

Potentially unhandled rejection [2] variable @table-header-height is
undefined in file /blahblahblah

Here is my set-up:

gulp.task('styles:crhistian',['clean:styles'], function(){
   return gulp
    .src([].concat(
    config.src + '**/*.less',
    config.components.styles.less
))
   .pipe(less())
   .pipe(gulp.dest('./crhistian'));
});

Ideally I'm aiming for this in my index.html file:

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">

<link rel="stylesheet" href="localfiles.css">
Prabhat Sinha
  • 1,500
  • 20
  • 32
Crhistian
  • 67
  • 12
  • It's a bit difficult to answer since it pretty similar to "how to compile a program with errors"... If some file uses a certain variable, that variable must be defined and be visible in the said file. It's not hard to guess though that your problem is in `concat('*.less')` which tries to compile every less file there *independently* and then concatenate the resulting CSS. This is expected to fail if a certain file (let's say "app.less") uses a variable defined in another (let's say "variables.less") and does not include it (via `@import`) explicitly. – seven-phases-max Apr 24 '16 at 20:32
  • Well, see http://stackoverflow.com/questions/21025995/gulp-less-not-handling-includes-properly-included-variables-not-defined (I guess it's safe to assume that your Q is an exact duplicate of that ticket). – seven-phases-max Apr 24 '16 at 20:36

0 Answers0