dlmanning / gulp-sass

SASS plugin for gulp
MIT License
1.56k stars 382 forks source link

@import just doesn't work #721

Closed davidrhoderick closed 5 years ago

davidrhoderick commented 5 years ago

I have a very simple scss file:

@import '../bower_components/normalize-scss/sass/_normalize.scss';

h1 {
  color: red;
}

I have verified that normalize is where it should be and tried double quotes as well as just putting an incorrect value there to throw an error, but nothing has changed.

Here is my gulpfile:

var gulp        = require('gulp'),
    sass        = require('gulp-sass'),
    include     = require('gulp-include'),
    jshint      = require('gulp-jshint'),
    minify      = require('gulp-minify'),
    sassLint    = require('gulp-sass-lint'),
    notify      = require('gulp-notify'),
    cleanCSS    = require('gulp-clean-css'),
    replace     = require('gulp-replace'),
    connect     = require('gulp-connect'),
    open        = require('gulp-open');

gulp.task('sass', function(){
  gulp.src('src/scss/style.scss')
    .pipe(sass().on('error', notify))
    .pipe(sassLint({
      files: { ignore: 'src/bower_components/**/*.scss' }
    }))
    .pipe(gulp.dest('src/css'))
    .pipe(connect.reload());
});

gulp.task('js', function(){
  return gulp.src('src/js/script.js')
    .pipe(include())
      .on('error', notify)
    .pipe(jshint.reporter('default'))
    .pipe(minify({
      ext:{
        src: '.js',
        min: '.min.js'
      }
    }))
    .pipe(gulp.dest('build'))
    .pipe(connect.reload());
});

gulp.task('serve', ['sass', 'js', 'watch'], function () {
  connect.server({
    livereload: true
  });

  gulp.src(__filename)
    .pipe(open({app: 'google-chrome', uri: 'http://localhost:8080'}));
});

gulp.task('html', function() {
  gulp.src('*.html')
    .pipe(gulp.dest('./'))
    .pipe(connect.reload());
});

gulp.task('watch', function () {
  gulp.watch('src/scss/**/*.scss', ['sass']);
  gulp.watch('src/js/**/*.js', ['js']);
  gulp.watch(['*.html'], ['html']);
});

gulp.task('default', ['serve']);

When I start my server or save my scss file, I check my style.css file and there is nothing but the hand-coded h1 style. No normalize code has been brought in. Anything I can try? I've uninstalled node_modules countless times and tried the LTS node version as well as node 9. I can see that node-sass 4.11.0 is installed. gulp-sass is on 4.0.2, which as far as I can tell is the latest.

davidrhoderick commented 5 years ago

The library I was importing, normalize.scss as found at https://github.com/appleboy/normalize.scss, requires a @include normalize(); to start working and output anything.