  

const { series,watch } = require('gulp');
const  gulp = require('gulp');
var sass        = require('gulp-sass');

const sourcemaps = require('gulp-sourcemaps');

const concat = require('gulp-concat');
let cleanCSS = require('gulp-clean-css');
var browserSync = require('browser-sync').create();
var sass        = require('gulp-sass');

var cssmin = require('gulp-minify-css');
var rename = require("gulp-rename");

var uglify = require('gulp-uglify');

const autoprefixer = require('gulp-autoprefixer'); 


function hello()
{
console.log('Hello world!');
        done();

	
}

exports.hello=hello;


function do1()
{
	
	
return gulp

       .src('node_modules/bootstrap/scss/*.scss	')//takes scss from node modules & puts css in ui folder 
       .pipe(sass())
       .pipe(concat('bootstrap.css'))
       .pipe(gulp.dest('public/css'))
	} 	




exports.do1=do1;













function do2() {
	
    	
    return (
	
        gulp
	
            .src("scss/*.scss")
            .pipe(sass())
	        .on("error", sass.logError)
	        // What is the destination for the compiled file?
	        .pipe(gulp.dest("public/css"))
	           .pipe(gulp.dest("public/minCss"))
    );
	
}
	exports.do2 = do2;
 
 
 
 
 function do3()
{
	
	
return gulp

       .src('vendor/twbs/bootstrap/scss/*.scss	')//takes scss from vendor  & puts css in CI4 public/css thus choice of using bootstart via npm or composer 
       .pipe(sass())
       .pipe(concat('bootstrap.css'))
       .pipe(gulp.dest('public/css'))
	} 	




exports.do3=do3;

 
 
 
 
 
    
    
    function monitor(){
	
    // gulp.watch takes in the location of the files to watch for changes
	
    // and the name of the function we want to run on change
	
    gulp.watch('scss/*.scss', series( do2));
	
}
	
   
	
exports.monitor= monitor  
    
    
   





 
gulp.task('minify', () =>
    gulp.src('public/css/*.css')
        .pipe(sourcemaps.init())
        .pipe(autoprefixer())
        .pipe(concat('style.css'))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('public/minCss'))
);    
    
    
 
 
