Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable programmatically? #119

Closed
milesj opened this issue May 21, 2015 · 2 comments
Closed

Disable programmatically? #119

milesj opened this issue May 21, 2015 · 2 comments
Labels

Comments

@milesj
Copy link

milesj commented May 21, 2015

Is there any easy way to do this? Say I pass gulp --no-sourcemaps to the CLI, I want to disable sourcemaps from the Gulp layer.

gulp.task('css', function() {
    return gulp.src(config.css.src + '/**/*.scss')
        .pipe(sourcemaps.init())
            .pipe(sass())
            .pipe(prefixer({
                browsers: ['last 3 versions'],
                cascade: false
            }))
        .pipe(sourcemaps.write('../maps/css', { enabled: options.sourcemaps })) // HERE or something similar
        .pipe(gulp.dest(config.css.dst));
});
@floridoo
Copy link
Member

You can use the normal javascript if statement to remove sourcemaps.init() and sourcemaps.write() from the pipeline. Another option is the gulp-if plugin.

@milesj
Copy link
Author

milesj commented May 21, 2015

gulp-if looks like the better option. Thanks!

@milesj milesj closed this as completed May 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants