gulp-sass为load_path支持工作吗? [英] gulp-sass work around for load_path support?

查看:248
本文介绍了gulp-sass为load_path支持工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:
我使用gulp-sass,并想定义一个load_path,这样我就不必有真正长的@import规则voor bower依赖,例如

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"

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

当使用gulp-sass

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

推荐答案

在自己努力之后,我在gulp-sass中找到了一个选项: / p>

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


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

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

示例:

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'));
});

这篇关于gulp-sass为load_path支持工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆