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

Won't build scss partials. #20

Open
hutber opened this issue Jul 3, 2015 · 3 comments
Open

Won't build scss partials. #20

hutber opened this issue Jul 3, 2015 · 3 comments

Comments

@hutber
Copy link

hutber commented Jul 3, 2015

I have yet to be able to get this working with partials, only multiple base scss files.

My setup:

Gulp

javascript
var SRC = './stylesheets/**/*.scss';
var DEST = './stylesheets';
gulp.task('sass', function() {
return gulp.src(SRC)
//.pipe(changed(DEST, { extension: '.css' }))
.pipe(newer({ dest: DEST, ext: '.css' }))
.pipe(plumber({
errorHandler: handleErrors
}))
.pipe(sourcemaps.init())
.pipe(sass({}))
.pipe(sourcemaps.write('./'))
.on('error', handleErrors)
.pipe(gulp.dest(DEST))
});


``` SCSS````
main.scss
    ¬ tools
       ¬ _generic-tool.scss

Main.scss
     @import "tools/generic-tool";

Any saves made inside main.scss will compile a new css file.
However any saves made in any partial, in this particular case any saves made inside of _generic-tool will not compile any css.

Windows 7 64-bit
version gulp-newer 0.5.0

@TimMensch
Copy link
Contributor

Look at the new "options.extra" feature. It will handle this case like so:

var SRC = './stylesheets/**/*.scss';
var DEST = './stylesheets';
gulp.task('sass', function() {
  return gulp.src(SRC)
    .pipe(newer({ dest: DEST, ext: '.css', extra:SRC }))
    .pipe(plumber({
        errorHandler: handleErrors
    }))
    .pipe(sourcemaps.init())
    .pipe(sass({}))
    .pipe(sourcemaps.write('./'))
    .on('error', handleErrors)
    .pipe(gulp.dest(DEST))
});

If any of the files that extra can see change, then it rebuilds all the files.

If I were doing this, I'd change the gulp.src to point to the one source file that includes the others (Main.scss in your example, or a small set of such source files). Otherwise it's building most of the scss files twice.

@QJan84
Copy link

QJan84 commented Jan 2, 2019

If any of the files that extra can see change, then it rebuilds all the files.

Is there a way that only the respective parent file is compiled?

@TimMensch
Copy link
Contributor

Not using the "extra" mechanism, no. And given that SASS/SCSS files have complex include structures, you'd need something that understood SASS/SCSS syntax in order to accomplish that.

Something like sass --watch. Then just use Gulp to copy the css files to the proper destinations (if needed).

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

3 participants