gpt4 book ai didi

css - gulp-sass 解决 load_path 支持?

转载 作者:技术小花猫 更新时间:2023-10-29 10:54:25 26 4
gpt4 key购买 nike

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

@import "normalize"

代替

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

在使用使用 LibSass 引擎处理 sass 文件的 gulp-sass 时,实现此目标的最佳方法是什么?

最佳答案

在我自己努力解决这个问题之后,我在 gulp-sass 中找到了一个选项:

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

关于css - gulp-sass 解决 load_path 支持?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32265121/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com