Skip to content

Commit a516df0

Browse files
committed
added task for rebuilding only scss files that change
1 parent 006c296 commit a516df0

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

gulpfile.js

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ var gulpif = require('gulp-if');
88
var sass = require('gulp-sass');
99
var server = require('./server');
1010
var bourbon = require('node-bourbon').includePaths;
11+
var watch = require('gulp-watch');
1112

1213
gutil.log('Environment', gutil.colors.blue(gulp.env.production ? 'Production' : 'Development'));
1314

@@ -37,6 +38,17 @@ gulp.task('styles', function () {
3738
.pipe(gulp.dest('./dist/css'));
3839
});
3940

41+
gulp.task('watch-sass', function () {
42+
return gulp.src('./src/scss/**/*.scss')
43+
.pipe(watch())
44+
.pipe(sass({
45+
outputStyle: gulp.env.production ? 'compressed' : 'expanded',
46+
includePaths: ['./src/scss'].concat(bourbon),
47+
errLogToConsole: gulp.env.watch
48+
}))
49+
.pipe(gulp.dest('./dist/css'));
50+
});
51+
4052
gulp.task('default', function() {
4153
gulp.env.watch = true;
4254
var servers = server(8080, 35729);

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"reactify": "~0.5.1",
3030
"tiny-lr": "0.0.5",
3131
"express": "~3.4.7",
32-
"chokidar": "~0.8.1"
32+
"chokidar": "~0.8.1",
33+
"gulp-watch": "~0.5.0"
3334
},
3435
"engines": {
3536
"node": ">=0.10.0"

src/scss/_config.scss

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
$color-red: red;
2+
3+
p.config {
4+
padding: 20px;
5+
}

src/scss/main.scss

+2
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,5 @@ a.button, button {
5656
}
5757
}
5858
}
59+
60+
@import 'config';

0 commit comments

Comments
 (0)