Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp-sass work around for load_path support?

Problem: I'm using gulp-sass and would like to define a load_path so that I don't have to have really long @import rules voor bower dependencies e.g.

@import "normalize"

instead of

@import "../../../../../bower_components/bootstrap-sass/assets/stylesheets/bootstrap/normalize"

What is the best way to i achieve this when using gulp-sass which uses the LibSass engine to process sass files?

like image 873
Timidfriendly Avatar asked Aug 28 '15 07:08

Timidfriendly


1 Answers

After struggling with this myself I found a option in gulp-sass :

sass({includePaths: ['./bower_components/bootstrap-sass/assets/stylesheets']})

Example:

var gulp = require('gulp'),
    sass = require('gulp-sass')
    notify = require("gulp-notify");

var config = {
    sassPath: './resources/sass',   // store the sass files I create
    bowerDir: './bower_components'
}

gulp.task('css', function() {
  return gulp.src(config.sassPath + '/style.scss')
    .pipe(sass({
        outputStyle: 'compressed',
        includePaths: [
            './resources/sass',
            config.bowerDir + '/bootstrap-sass/assets/stylesheets',
            config.bowerDir + '/font-awesome/scss']
        })
       .on("error", notify.onError(function (error) {
            return "Error: " + error.message;
        })))
    .pipe(gulp.dest('./public/css'));
});
like image 116
Mrunal Kanti Roy Avatar answered Oct 03 '22 19:10

Mrunal Kanti Roy