jeff2ma / gulp-better-sass-inheritance Goto Github PK
View Code? Open in Web Editor NEWRecompile only changed sass/scss files and their dependencies (imported, extended, or included).
License: MIT License
Recompile only changed sass/scss files and their dependencies (imported, extended, or included).
License: MIT License
when compiling scss files it returns empty files.
gulpfile.js:
'use strict';
var gulp = require('gulp');
var sassInheritance = require('gulp-better-sass-inheritance');
var sass = require('gulp-sass');
var cached = require('gulp-cached');
var gulpif = require('gulp-if');
var filter = require('gulp-filter');
const styleChanged = () => {
return gulp.src("./STYLE/**/*.scss")
.pipe(gulpif(global.isWatching, cached("sass")))
.pipe(sassInheritance({base: "./STYLE/"}))
.pipe(filter(function (file) {
return !/\/_/.test(file.path) || !/^_/.test(file.relative);
}))
.pipe(sass())
.pipe(gulp.dest("./_Build/STYLE"));
};
const doWatch = () => {
global.isWatching = true;
gulp.watch("./STYLE/**/*.scss", styleChanged);
};
exports.default = doWatch;
exports.styleChanged = styleChanged;
您好 :)
十分感谢您写的文章 以及贡献了如此实用的 gulp 插件,帮助我在工作中节省大量的时间。
不过,再一次尝试使用 gulp-sass-glob 的过程中,使用 @import 'base/**/*';
这样的语法时遇到了错误:
Error: File to import not found or unreadable: base/**/*.
Parent style sheet: /path_to/project/src/styles/app.scss
on line 7 of scss/app.scss
>> @import 'base/**/*';
这是我的 gulp 配置文件:
var gulp = require('gulp');
var sassInheritance = require('gulp-better-sass-inheritance');
var sass = require('gulp-sass');
var cached = require('gulp-cached');
var sassGlob = require('gulp-sass-glob');
gulp.task('sass', function(done) {
return gulp.src("src/styles/*")
.pipe(cached('sass'))
.pipe(sassGlob())
.pipe(sassInheritance({base: 'src/styles/'}))
.pipe(sass())
.pipe(gulp.dest("src/styles/*"))
});
不知您是否遇到过类似的问题与对应的解决方案么?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.