Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import change not triggering parent file re-compile. #39

Closed
ShaneHowell opened this issue Mar 26, 2014 · 7 comments
Closed

Import change not triggering parent file re-compile. #39

ShaneHowell opened this issue Mar 26, 2014 · 7 comments

Comments

@ShaneHowell
Copy link

I'm having an issue with the parent file not re compiling when an import is changed.
For example, I have a base file called global.scss which imports a partial _header.scss.

But when the _header.scss is changed, it doesn't recompile global.scss.
The watch task is seeing the file being changed but its parent doesn't recompile.

[gulp] _header.scss was changed

Watch function:

// Watch SCSS
    gulp.src(input_paths.styles, { read: false })
        .pipe(plumber())                                // Keeps pipes working after error event
        .pipe(watch())                                  // Watches for file changes
        .pipe(scss( scss_options ))                     // SCSS compiler
        .pipe( gulp.dest( output_paths.styles ) )       // Output destination
        .pipe(livereload(server))                       // Reload the page
        .pipe( notify( notify_options ) );              // Notify what file was changed

scss_options variable:

// Sass
    var scss_options = {
        outputStyle: 'compressed', // variables - https://github.com/andrew/node-sass
        errLogToConsole: false,
        onError: function(err) {
            notify().write(err);                    // Growl it.
            console.log(gutil.colors.red(err));      // Log the occurred error.
            process.stdout.write('\x07');          // Beep boop the terminal.
        }
    };

Not 100% sure this is a gulp-sass issue though.

@apaleslimghost
Copy link

If you use the built-in gulp.watch, when you change any of the files they are all recompiled. libsass is fast enough that this isn't really a problem.

gulp.watch('app/scss/*.scss', ['sass-watch']);
gulp.task('sass-watch', function() {
  return gulp.src('app/scss/*.scss')
    .pipe(sass(sassOptions))
    .pipe(gulp.dest('app/css'))
    .pipe(livereload());
});

@ShaneHowell
Copy link
Author

@quarterto IMO, no watch set up should have to recompile every file when only one file has changed. It may be fast but it would still shave off many seconds by only compiling changed files.

I've also tested it both ways. While libsass is fast, it's exponentially faster when only compiling changed files, especially on larger projects.

@apaleslimghost
Copy link

Then use gulp-newer or gulp-changed.

EDIT actually, this has the same problem. sorry!

@dlmanning
Copy link
Owner

As @quarterto suggests, this is outside the domain of gulp-sass. gulp plugins are not supposed to be one-stop-shops for the entire build process. gulp-sass's only job is to allow the inclusion of node-sass in a build chain.

@ShaneHowell
Copy link
Author

Apologies, I did in fact post this issue to the wrong plugin.

@apaleslimghost
Copy link

@ShaneHowell just found gulp-sass-graph

@nucklearproject
Copy link

This plugin solve this issue
https://www.npmjs.com/package/gulp-dependents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants