1

it's the fifth day when I'm fighting this and I'm almost ready to give up (but I can't). I picked up a project from someone else and I'm trying to make gulp work.

I ended up with "could not find an option named "sourcemap".

Starting 'watch'...
[11:48:54] Finished 'watch' after 2.75 s
[11:49:32] Starting 'styles'...
[11:49:33] Could not find an option named "sourcemap".
Usage: dart-sass <input>

in gulpfile.js I've got this:

gulp.task('styles', () => {
    return sass(['_/sass/main.scss', '_/sass/editor.scss', '_/sass/career-form.scss'], {
    sourcemap: true, style: "compact"
    })
})

even when I delete the sourcemap: true part, the error is still there. Gulp works with js files, but not with CSS. not sure if that matter.

I use gulp-ruby-sass and I tried everything there were related to the issue, but no luck. (The guy that worked before on that is not helpful - "I don't know, go Google the error").

I already tried to rebuild node_modules, five times, maybe more, checked different versions of gulp-ruby-sass and gulp-sourcemaps. Looked for another usage of sourcemap but no luck.

2 Answers 2

2

From the gulp-ruby-sass sourcemap option documentation it looks like if you use the sourcemap option than you must also use gulp-sourcemaps.

sourcemap
Type: boolean Default: false

Initialize and pass Sass sourcemaps to gulp-sourcemaps.

So their code:

const gulp = require('gulp');
const sass = require('gulp-ruby-sass');
const sourcemaps = require('gulp-sourcemaps');

gulp.task('sass', () =>
    sass('source/file.scss', {sourcemap: true})
        .on('error', sass.logError)
        // for inline sourcemaps 
        .pipe(sourcemaps.write())
        // for file sourcemaps 
        .pipe(sourcemaps.write('maps', {
            includeContent: false,
            sourceRoot: 'source'
        }))
        .pipe(gulp.dest('result'))
);

So try them together. [Why you still get an error message if you remove the sourcemap option is strange.]

Sign up to request clarification or add additional context in comments.

1 Comment

the sourcemaps is there.
1

A late answer but still hope it could help.

If you use gulp-ruby-sass, you will have to install ruby.

However, gulp-ruby-sass has been deprecated, so it's better to switch to gulp-sass to compile Sass files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.