Reputation: 1625
I'm making edits to a project that uses scss. As I work locally the changes I make to the scss are reflected on my local server. However, there are minified css files that are part of the project and I feel like I should update those as well. Is there something I should be doing to generate those minified files as I go, or maybe an additional step I should take to regenerate those minified files?
Upvotes: 3
Views: 1903
Reputation: 1568
An automated task runner would be perfect for this, here's an example in Gulp.
$ npm install -g gulp && npm install gulp gulp-sass
In the root directory of your project, add a file named gulpfile.js
, and place the following code into the file:
var sass = require('gulp-sass');
// Compile all the .scss files from
// ./scss to ./css
gulp.task('scss', function () {
gulp.src('./scss/**/*.scss')
.pipe(sass())
.pipe(gulp.dest('./css'));
});
// Watches for file changes
gulp.task('watch', function(){
gulp.watch('./scss/**/*.scss', ['scss']);
});
gulp.task('develop', ['scss', 'watch']);
In the terminal, run:
$ gulp develop
and try to make changes to your scss files. They are now automatically compiled on every save!
Upvotes: 2