From 9619e5d66759e803723d12eeb7c11f464df6f4b4 Mon Sep 17 00:00:00 2001 From: Nashid Shah Date: Fri, 10 Nov 2023 14:48:49 -0500 Subject: [PATCH] Added sitemap and updated gulp --- .github/workflows/npm-gulp.yml | 3 - gulpfile.js | 196 ++++++++++++++++++--------------- sitemap.xml | 19 ++++ 3 files changed, 127 insertions(+), 91 deletions(-) create mode 100644 sitemap.xml diff --git a/.github/workflows/npm-gulp.yml b/.github/workflows/npm-gulp.yml index 35c1ab8..bce18a9 100644 --- a/.github/workflows/npm-gulp.yml +++ b/.github/workflows/npm-gulp.yml @@ -47,9 +47,6 @@ jobs: name: dist path: dist - - name: List files - run: ls -R - - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: diff --git a/gulpfile.js b/gulpfile.js index e330155..b195db2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,71 +1,75 @@ -// Include the required tools used on tasks -const { watch, src, series, dest, parallel } = require('gulp'); -const terser = require('gulp-terser'); -const newer = require("gulp-newer"); -const babel = require("gulp-babel"); -const postcss = require('gulp-postcss'); -const cleanCSS = require('gulp-clean-css'); -const cssbeautify = require('gulp-cssbeautify'); -const concat = require('gulp-concat'); -const htmlmin = require('gulp-htmlmin'); -const inlinesource = require('gulp-inline-source'); -const cachebust = require('gulp-cache-bust'); -const eslint = require('gulp-eslint'); -const imagemin = require("gulp-imagemin"); -const autoprefixer = require('autoprefixer'); -const del = require('del'); +// Include the required tools used on tasks +const { watch, src, series, dest, parallel } = require("gulp") +const terser = require("gulp-terser") +const newer = require("gulp-newer") +const babel = require("gulp-babel") +const postcss = require("gulp-postcss") +const cleanCSS = require("gulp-clean-css") +const cssbeautify = require("gulp-cssbeautify") +const concat = require("gulp-concat") +const htmlmin = require("gulp-htmlmin") +const inlinesource = require("gulp-inline-source") +const cachebust = require("gulp-cache-bust") +const eslint = require("gulp-eslint") +const imagemin = require("gulp-imagemin") +const autoprefixer = require("autoprefixer") +const del = require("del") // Initialise plugins -const browsersync = require('browser-sync').create(); +const browsersync = require("browser-sync").create() // const reload = browserSync.reload; // Specify the Source files -const SRC_HTML = ['index.html']; -const SRC_JS = 'app.js'; -const SRC_JS_MODULES = ['assets/js/jquery-3.5.1.min.js', 'assets/js/jquery-ui-1.12.1.min.js', 'assets/js/lazysizes.min.js']; -const SRC_CSS = ['assets/css/*.css', '!assets/css/preloader.css']; -const SRC_IMG = 'assets/img/*'; -const SRC_PDF = 'assets/pdf/*'; +const SRC_HTML = ["index.html"] +const SRC_JS = "app.js" +const SRC_JS_MODULES = [ + "assets/js/jquery-3.5.1.min.js", + "assets/js/jquery-ui-1.12.1.min.js", + "assets/js/lazysizes.min.js", +] +const SRC_CSS = ["assets/css/*.css", "!assets/css/preloader.css"] +const SRC_IMG = "assets/img/*" +const SRC_PDF = "assets/pdf/*" // Specify the Destination folders -const DEST_HTML = 'dist/'; -const DEST_JS = 'dist/js'; -const DEST_CSS = 'dist/css'; -const DEST_IMG = 'dist/img'; -const DEST_PDF = 'dist/pdf'; +const DEST_HTML = "dist/" +const DEST_JS = "dist/js" +const DEST_CSS = "dist/css" +const DEST_IMG = "dist/img" +const DEST_PDF = "dist/pdf" // BrowserSync function browserSync(done) { browsersync.init({ server: { - baseDir: "./dist/" + baseDir: "./dist/", }, - port: 3000 - }); - done(); + port: 3000, + }) + done() } // BrowserSync Reload function browserSyncReload(done) { - browsersync.reload(); - done(); + browsersync.reload() + done() } // CLEAN files function htmlClean() { - return del([DEST_HTML]); + return del([DEST_HTML]) } function jsClean() { - return del([DEST_JS]); + return del([DEST_JS]) } function cssClean() { - return del([DEST_CSS]); + return del([DEST_CSS]) } function imgClean() { - return del(['./dist/assets']); + return del(["./dist/assets"]) } // Lint files @@ -73,94 +77,110 @@ function lint() { return src(SRC_JS) .pipe(eslint()) .pipe(eslint.format()) - .pipe(eslint.failAfterError()); + .pipe(eslint.failAfterError()) } -// Build JS +// Build JS function jsBuild() { return src(SRC_JS) .pipe(babel()) .pipe(terser()) - .pipe(concat('app.min.js')) - .pipe(dest(DEST_JS)); + .pipe(concat("app.min.js")) + .pipe(dest(DEST_JS)) } -// Build CSS +// Build CSS function cssBuild() { return src(SRC_CSS) .pipe(postcss([autoprefixer()])) .pipe(cssbeautify({ autosemicolon: true })) - .pipe(cleanCSS({ compatibility: 'ie8' })) - .pipe(concat('styles.min.css')) - .pipe(dest(DEST_CSS)); + .pipe(cleanCSS({ compatibility: "ie8" })) + .pipe(concat("styles.min.css")) + .pipe(dest(DEST_CSS)) } function htmlBuild() { return src(SRC_HTML) .pipe(htmlmin({ collapseWhitespace: true, removeComments: true })) .pipe(inlinesource({ compress: true })) - .pipe(cachebust({ - type: 'timestamp' - })) - .pipe(dest(DEST_HTML)); + .pipe( + cachebust({ + type: "timestamp", + }) + ) + .pipe(dest(DEST_HTML)) } function images() { return src(SRC_IMG) .pipe(newer(DEST_IMG)) - .pipe(imagemin([ - imagemin.gifsicle({ interlaced: true }), - imagemin.mozjpeg({ progressive: true }), - imagemin.optipng({ optimizationLevel: 5 }), - imagemin.svgo({ - plugins: [{ - removeViewBox: false, - collapseGroups: true - }] - }) - ])) + .pipe( + imagemin([ + imagemin.gifsicle({ interlaced: true }), + imagemin.mozjpeg({ progressive: true }), + imagemin.optipng({ optimizationLevel: 5 }), + imagemin.svgo({ + plugins: [ + { + removeViewBox: false, + collapseGroups: true, + }, + ], + }), + ]) + ) .pipe(dest(DEST_IMG)) - .pipe(dest('dist/img')); + .pipe(dest("dist/img")) } function jsModulesCopy() { - return src(SRC_JS_MODULES) - .pipe(dest(DEST_JS)); + return src(SRC_JS_MODULES).pipe(dest(DEST_JS)) } function copyFiles() { - return src('googlec6cb74579ce2fc25.html') - .pipe(dest(DEST_HTML)) + return src([ + "googlec6cb74579ce2fc25.html", + "sitemap.xml", + "robots.txt", + "README.md", + ]).pipe(dest(DEST_HTML)) } function pdfCopy() { - return src(SRC_PDF) - .pipe(dest(DEST_PDF)); + return src(SRC_PDF).pipe(dest(DEST_PDF)) } // WATCH for file changes and run the tasks function watchFiles() { - watch(SRC_JS, jsBuild); - watch(SRC_JS_MODULES, jsModulesCopy); - watch(SRC_CSS, cssBuild); - watch(SRC_PDF, pdfCopy); - watch(['assets/css/preloader.css', 'index.html'], htmlBuild); - watch(SRC_IMG, images); - watch([...SRC_JS, ...SRC_CSS, 'index.html'], browserSyncReload); + watch(SRC_JS, jsBuild) + watch(SRC_JS_MODULES, jsModulesCopy) + watch(SRC_CSS, cssBuild) + watch(SRC_PDF, pdfCopy) + watch(["assets/css/preloader.css", "index.html"], htmlBuild) + watch(SRC_IMG, images) + watch([...SRC_JS, ...SRC_CSS, "index.html"], browserSyncReload) } -const clean = parallel(jsClean, cssClean, imgClean); -const build = parallel(htmlBuild, jsBuild, cssBuild, images, jsModulesCopy, pdfCopy, copyFiles); -const watcher = parallel(watchFiles, browserSync); +const clean = parallel(jsClean, cssClean, imgClean) +const build = parallel( + htmlBuild, + jsBuild, + cssBuild, + images, + jsModulesCopy, + pdfCopy, + copyFiles +) +const watcher = parallel(watchFiles, browserSync) // Export tasks -exports.lint = lint; -exports.htmlBuild = series(htmlClean, htmlBuild); -exports.jsBuild = series(jsClean, lint, parallel(jsBuild, jsModulesCopy)); -exports.cssBuild = series(cssClean, cssBuild); -exports.pdfCopy = pdfCopy; -exports.jsModulesCopy = jsModulesCopy; -exports.images = images; -exports.watch = watcher; -exports.build = build; -exports.default = series(clean, build); \ No newline at end of file +exports.lint = lint +exports.htmlBuild = series(htmlClean, htmlBuild) +exports.jsBuild = series(jsClean, lint, parallel(jsBuild, jsModulesCopy)) +exports.cssBuild = series(cssClean, cssBuild) +exports.pdfCopy = pdfCopy +exports.jsModulesCopy = jsModulesCopy +exports.images = images +exports.watch = watcher +exports.build = build +exports.default = series(clean, build) diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..a88a49d --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,19 @@ + + + + + https://nashidahmed.github.io/ + 2020-11-22 + weekly + 0.8 + + + + https://nashidahmed.github.io/pdf/RFID_vending_machine_thesis.pdf + 2020-11-22 + never + + + \ No newline at end of file