gulp-community / gulp-less

A LESS plugin for Gulp
559 stars 116 forks source link

Value requires an array argument #277

Closed tonister closed 6 years ago

tonister commented 6 years ago

Hey, so the issue is that since today morning, for whatever the reason, gulp-less started giving me this error on Cloud9:

tonister:~/workspace (master) $ gulp less
[08:20:44] Using gulpfile ~/workspace/gulpfile.js
[08:20:44] Starting 'less'...
[08:20:44] { Error: Value requires an array argument
    at Value (/home/ubuntu/workspace/node_modules/less/lib/less/tree/value.js:6:15)
    at Media (/home/ubuntu/workspace/node_modules/less/lib/less/tree/media.js:14:21)
    at Object.media (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1375:29)
    at Object.directive (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1431:67)
    at Object.primary (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:264:92)
    at Object.block (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1107:63)
    at Object.media (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1367:34)
    at Object.directive (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1431:67)
    at Object.primary (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:264:92)
    at Object.parse (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:133:61)
  type: 'Syntax',
  filename: '/home/ubuntu/workspace/src/less/styles.less',
  index: undefined,
  line: null,
  callLine: NaN,
  callExtract: undefined,
  column: -1,
  extract: [ undefined, undefined, '@color-primary: #333;' ],
  message: 'Value requires an array argument in file /home/ubuntu/workspace/src/less/styles.less line no. null',
  stack: 'Error: Value requires an array argument
at Value (/home/ubuntu/workspace/node_modules/less/lib/less/tree/value.js:6:15)
at Media (/home/ubuntu/workspace/node_modules/less/lib/less/tree/media.js:14:21)
at Object.media (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1375:29)
at Object.directive (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1431:67)
at Object.primary (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:264:92)
at Object.block (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1107:63)
at Object.media (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1367:34)
at Object.directive (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:1431:67)
at Object.primary (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:264:92)
at Object.parse (/home/ubuntu/workspace/node_modules/less/lib/less/parser/parser.js:133:61)',
  lineNumber: null,
  fileName: '/home/ubuntu/workspace/src/less/styles.less',
  name: 'Error',
  showStack: false,
  showProperties: true,
  plugin: 'gulp-less' }

This is the gulp task that I use:

gulp.task('less', function() {
    return gulp.src(srcFolder + 'less/styles.less')
        .pipe(gulp.less().on('error', gulp.util.log))
        .pipe(gulp.autoprefixer('last 20 major versions'))
        .pipe(gulp.cachebust.resources())
        .pipe(gulp.dest(distFolder + 'css/'))
        .pipe(browserSync.reload({
            stream: true
        }));
});

I've tried removing any other dependency than gulp-less from this task and it still gives me the error. I've also tried reinstalling all the npm tools, but still the error occurs.

How to move forward ?

tonister commented 6 years ago

even using lessc for compiling LESS, it gives error. Something wrong with lessc ?

tonister:~/workspace (master) $ lessc src/less/styles.less 
SyntaxError: Value requires an array argument in /home/ubuntu/workspace/src/less/styles.less on line null, column 0:
1 @color-primary: #333;
tonister commented 6 years ago

oh well... after all... my LESS file was broken... Tried implementing some CSS tricks for explicitly targeting iPhone & Safari combination... seems they don't work with LESS or at all... Here are the snippets

/* Safari 6.1-10.0 (not 10.1, which is the latest version of Safari at this time) */

@media screen and (min-color-index:0) and(-webkit-min-device-pixel-ratio:0) {
    @media {
        .product {
            display: block;
            height: 100%;
            .product-logo {
                display: block;
                height: 3em;
            }
            .content {
                display: block;
                height: calc(~"100% - 3em"); // height: 100%;
                .header {
                    display: block;
                    height: auto;
                }
                .center {
                    display: block;
                    height: auto;
                }
            }
        }
    }
}

/* Safari 6.1-7.0 */

@media screen and (-webkit-min-device-pixel-ratio:0) and (min-color-index:0) {
    .product {
        (;
        display: block;
        height: 100%;
        .product-logo {
            display: block;
            height: 3em;
        }
        .content {
            display: block;
            height: calc(~"100% - 3em"); // height: 100%;
            .header {
                display: block;
                height: auto;
            }
            .center {
                display: block;
                height: auto;
            }
        }
        color:#0000FF;
        background-color:#CCCCCC;

        );
    }
}
stephenlacy commented 6 years ago

Sorry, was at a conference, glad you figured it out.

I have noticed that mixed indentations completely breaks lessc, and is hard to determine.