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?
1 Answer
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!
4 Comments
pixelfairy
 Thank you! I'm now realizing that it's only the bootstrap files that are minified and not the rest of them which is kinda convenient for me... but it was confusing, so it should be made more clear somehow.
  pixelfairy
 I'm not editing the bootstrap files yet ...so, I'm going to tackle my next task of editing the haml files.. I'm not sure if I'm being a bad citizen of StackOverflow but I'm going to mark this as answered without actually testing it. Thank you for the answer. I will definitely use this in future projects.
  Ben
 Oh interesting hahaha let me know if more help or clarification is needed!
  pixelfairy
 if you are curious the codebase is at github.com/city72/city-72
  
