Coder Social home page Coder Social logo

Comments (3)

juanfran avatar juanfran commented on September 26, 2024 1
gulp.task('scss-lint', function() {
    return gulp.src('**/*.scss')
        .pipe(scsslint())
        .pipe(scsslint.failReporter());
});

gulp.task('sass', ['scss-lint'], function() {
    return gulp.src('**/*.scss')
        .pipe(scss());
});

from gulp-scss-lint.

juanfran avatar juanfran commented on September 26, 2024

hi!

Is this what you want?

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

gulp.task('lint', function() {
    var condition = function(file) {
        return !(file.scsslint.errors || file.scsslint.warnings);
    };

    return gulp.src('**/*.scss')
        .pipe(scsslint())
        .pipe(gulpif(condition, sass()));
});

from gulp-scss-lint.

Evaske avatar Evaske commented on September 26, 2024

How would this work in the fact that I don't want to be running sass() on every .scss file? Just the one file. Also, at the moment it runs that condition check for every scss file there is, so it will keep compiling multiple times until it hits an error. What I want is it to completely run through all the files with scss-lint and then run scss() if there are no errors found.

So basically want this to occur:

//  SCSS Linting. Ignores the reset file
gulp.task('scss-lint', function () {
  gulp.src([styleSheets + '**/*.scss', '!' + styleSheets + '**/_reset.scss'])
  .pipe(scssLint())
});

The scss-lint task runs, and if any Errors or Warnings occur, then nothing else happens. If no errors or warnings occur then I want it to run scss(). I don't want this to be on a file by file basis which is what happens with your code above but rather it lints all the SCSS files and then if it's successfully on all of them, then it runs the scss() on just the main styles.scss file.:

gulp.task('sass', function () {
  gulp.src(styleSheets + 'styles.scss')
  .pipe(sass({
    outputStyle: 'compressed'
  }))
  .on("error", notify.onError(function (error) {
    return error.message;
  }))
  .pipe(gulp.dest(styleSheetsDist))
  .pipe(notify({ message: "Stylesheets Compiled", title: "Stylesheets" }))
});

from gulp-scss-lint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.