sass文件没有用gulp sass编译成css

时间:2017-10-01 01:03:42

标签: css sass gulp gulp-sass

我的目录文件是

css
  --nothing yet
sass
  --style.sccs
Gulpfile.js
index.html
package.json

这是我的Gulpfile.js

'use strict';

var gulp = require('gulp');
var sass = require('gulp-sass');

var sassOptions = {
  errLogToConsole: true,
  outputStyle: 'expanded'
};

gulp.task('sass', function () {
  return gulp.src('./sass/**/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./css'));
});

gulp.task('watch', function() {
  return gulp
    // Watch the input folder for change,
    // and run `sass` task when something happens
    .watch('./sass/**/*.scss', ['sass'])
    // When there is a change,
    // log a message in the console
    .on('change', function(event) {
      console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
    });
});

gulp.task('default', ['sass', 'watch' ]);

这里是style.sccs

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}

当我从终端运行gulp时看起来没问题

PS C:\Users\delli\gulpsass> gulp
[21:02:08] Using gulpfile ~\gulpsass\gulpfile.js
[21:02:08] Starting 'sass'...
[21:02:08] Starting 'watch'...
[21:02:08] Finished 'watch' after 12 ms
[21:02:08] Finished 'sass' after 41 ms
[21:02:08] Starting 'default'...
[21:02:08] Finished 'default' after 43 μs

但是我的css文件夹总是空的

1 个答案:

答案 0 :(得分:1)

一定是拼写错误。

您的文件应为style.scss,而不是style.sccs