What is causing this "invalid top-level expression" error in my GULP gulpfile.js file? What is causing this "invalid top-level expression" error in my GULP gulpfile.js file? windows windows

What is causing this "invalid top-level expression" error in my GULP gulpfile.js file?


If you want to use the indented syntax (.sass) as the top level file, use

pipe(sass({ indentedSyntax: true }))

instead of

pipe(sass()).


Can you try to use the option sourceComments and set it to normal in your sass ? It seems to have some problems if you don't pass it.

So try to change your task as follow :

gulp.task('sass', function () {  gulp.src('app/assets/sass/styles.sass')    .pipe(sass({        errLogToConsole: true,        sourceComments : 'normal'    }))    .pipe(gulp.dest('public_html/assets/css'))});

See the related issue of gulp-sass. Alternatively, you can still use gulp-ruby-sass.


Hilariously, the problem for me was that the plugin gulp-sass ignores the extension of the top level file and parses as SCSS no matter what.

Includes worked correctly, so the solution was to make a one liner inclusion at the top.