Socket
Socket
Sign inDemoInstall

gulp-sass

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-sass

Gulp plugin for sass


Version published
Weekly downloads
358K
decreased by-0.91%
Maintainers
3
Weekly downloads
 
Created

What is gulp-sass?

The gulp-sass package is a Gulp plugin that allows you to compile Sass (Syntactically Awesome Stylesheets) files into CSS. It integrates seamlessly with Gulp, a toolkit for automating painful or time-consuming tasks in your development workflow.

What are gulp-sass's main functionalities?

Compile Sass to CSS

This feature allows you to compile Sass files into CSS. The code sample demonstrates a Gulp task that takes all .scss files from the src/scss directory, compiles them into CSS, and outputs them to the dist/css directory.

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

gulp.task('sass', function() {
  return gulp.src('./src/scss/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./dist/css'));
});

Watch for changes

This feature allows you to watch for changes in your Sass files and automatically compile them to CSS whenever a change is detected. The code sample demonstrates a Gulp task that watches the src/scss directory for changes and runs the 'sass' task whenever a change is detected.

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

gulp.task('sass', function() {
  return gulp.src('./src/scss/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./dist/css'));
});

gulp.task('watch', function() {
  gulp.watch('./src/scss/**/*.scss', gulp.series('sass'));
});

Source Maps

This feature allows you to generate source maps for your compiled CSS files, which can be useful for debugging. The code sample demonstrates a Gulp task that initializes source maps, compiles Sass to CSS, writes the source maps to a maps directory, and outputs the CSS to the dist/css directory.

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

gulp.task('sass', function() {
  return gulp.src('./src/scss/**/*.scss')
    .pipe(sourcemaps.init())
    .pipe(sass().on('error', sass.logError))
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest('./dist/css'));
});

Other packages similar to gulp-sass

Keywords

FAQs

Package last updated on 31 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc