Yes, you can use gulp -scss for this or gulp -ruby-sass. Now there are several that Gulp has been around for a while.
gulp -sass to compile sass files https://www.npmjs.com/package/gulp-sass
gulp - name for renaming files for the distribution folder https://www.npmjs.com/package/gulp-rename
In my case, I am currently using gulp -scss. You can simply run the task for your needs. In the example below, base.scss will be your scss file with all your @import instructions.
var gulp = require('gulp'), scss = require('gulp-scss'), rename = require('gulp-rename'); gulp.task('sass', function () { gulp.src('base.scss') .pipe(scss()) .pipe(rename('final.scss')) .pipe(gulp.dest('assets/css/')); });
Update:
Assuming you already have base.scss, which already has its own import statements. The above method should work. We simply run the scss task in the provided file, rename it and move it to any dest directory.
Update 2
Saving variables will require the use of the concat method, since all sass plugins are only for compiling sass in css. You do not need to specify all of your files. Only variables first, and then you can run glob for all your custom sass. Just make sure that you follow the same folder structure as in the array below for the proper separation and organization of assets.
You also do not need to worry about saving the import file. This is not needed, and with this method there will be less.
var gulp = require('gulp'), concat = require('gulp-concat'); var sassConcat = [ 'sass/variables.scss', 'sass/modules/**/*.scss' ]; gulp.task('sass', function () { gulp.src(sassConcat) .pipe(concat('final.scss')) .pipe(gulp.dest('../assets/sass/')); };
source share