Skip to content

Commit

Permalink
fix(core): fix linting for Stylus partials
Browse files Browse the repository at this point in the history
Linting was working only on main entry point file, other Stylus partials were completely ignored.
The solution was to create two gulp streams one for linting and one for processing. The linting
stream watches over all partials, while the process stream handles only the entry point file.
  • Loading branch information
0vidiu committed May 18, 2018
1 parent 9ded756 commit 46c0c65
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/tasks/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,20 @@ async function taskFn(done: any, { logger, config, paths, env, gulp }: any = {})
};

return new Promise((resolve, reject) => {
// Set the source path and filter unchanged files
gulp.src(entryPointPath, { since: gulp.lastRun(taskFn) })
// Create stream for linting Stylus partials
gulp.src(path.join(sourceDirPath, '**/*.styl'))
// Initialize gulp-plumber to prevent process termination in case of error
.pipe(plumber({ errorHandler: error => logger.fatal(error.message) }))
// Perform Stylus linting
.pipe(stylint(configs.stylint))
// Report Stylint errors if any
.pipe(stylint.reporter())
.pipe(plumber.stop());

// Create stream for Stylus partials processing
gulp.src(entryPointPath, { since: gulp.lastRun(taskFn) })
// Initialize gulp-plumber to prevent process termination in case of error
.pipe(plumber({ errorHandler: error => logger.fatal(error.message) }))
// Initialize source-maps only in development mode
.pipe(gulpif(env === 'development', sourcemaps.init()))
// Compile Stylus files
Expand Down

0 comments on commit 46c0c65

Please sign in to comment.