123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- const gulp = require('gulp'),
- concat = require('gulp-concat'),
- sass = require('gulp-sass');
- browserSync = require('browser-sync').create();
- function copy(cb) {
- gulp.src([
- './node_modules/bootstrap/dist/js/bootstrap.bundle.min.js',
- './node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map'
- ])
- .pipe(gulp.dest('./js/'));
- gulp.src([
- './node_modules/bootstrap/dist/css/bootstrap.min.css',
- './node_modules/bootstrap/dist/css/bootstrap.min.css.map',
- './node_modules/bootstrap-icons/font/bootstrap-icons.css'
- ])
- .pipe(gulp.dest('./css/'));
- gulp.src([
- './node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff',
- './node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2',
- ])
- .pipe(gulp.dest('./css/fonts/'));
- console.log("Copy assets ๐ฆ ");
- cb();
- }
- function build(cb) {
- gulp.src([
- './css/bootstrap-icons.css',
- './css/bootstrap.min.css',
- './css/styles.css',
- ])
- .pipe(concat('site.css'))
- .pipe(gulp.dest('./css/'));
- gulp.src([
- './js/bootstrap.bundle.min.js',
- ])
- .pipe(concat('site.js'))
- .pipe(gulp.dest('./js/'));
- console.log("Assets built ๐ง ");
- cb();
- }
- function clean (cb) {
- gulp.src('./css/site.css')
- .pipe(cleanCSS({level: {1: {specialComments: 0}}}))
- .pipe(gulp.dest('./css/'));
- console.log("CSS cleaned ๐งน ");
- cb();
- }
- function mixin() {
- return src('./css/*.scss', { sourcemaps: true })
- .pipe(sass().on('error',sass.logError))
- .pipe(gulp.dest('./css/'))
- .pipe(browserSync.stream());
- }
- function reload(cb) {
- browserSync.reload();
- cb();
- }
- function run() {
- browserSync.init({
- server: {
- baseDir: "./",
- index: "/index.html"
- }
- });
- gulp.watch('./css/*.scss', mixin);
- gulp.watch('./*.html', reload);
- gulp.watch([
- './css/site.css',
- './js/site.js'
- ]).on('change',browserSync.reload);
- console.log("๐ฅ Run");
- }
- exports.copy = copy;
- exports.build = build;
- exports.clean = clean;
- exports.mixin = mixin;
- exports.run = run;
-
|