Started base work on backend for timeline automation and also updated gulpfile.js to add a new task for deploying via ftp to host.
This commit is contained in:
parent
7d901093bf
commit
fba01f1d98
3
.gitignore
vendored
3
.gitignore
vendored
@ -70,3 +70,6 @@ fabric.properties
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
# Custom ignores
|
||||
.env
|
2
dist/index.html
vendored
2
dist/index.html
vendored
File diff suppressed because one or more lines are too long
2
dist/js/main.js
vendored
2
dist/js/main.js
vendored
@ -1 +1 @@
|
||||
const scrollLimit=150;window.onscroll=()=>{document.body.scrollTop>=150||document.documentElement.scrollTop>=150?document.querySelector("nav").classList.add("scrolled"):document.querySelector("nav").classList.remove("scrolled");let e="";document.querySelectorAll("section").forEach((t=>{const o=t.offsetTop;window.pageYOffset>=o-60&&(e=t.getAttribute("id"))})),document.querySelectorAll("nav ul li a").forEach((t=>{t.classList.remove("active"),t.href.includes(e)&&""!==e?t.classList.add("active"):""===e&&document.querySelector("nav ul li a").classList.add("active")}))},document.addEventListener("DOMContentLoaded",(()=>{var e=["full stack developer","web designer","student","gamer","drummer"];function t(e,o,n){o<e.length?(document.querySelector("header div h1").innerHTML=e.substring(0,o+1)+'<span aria-hidden="true">_</span>',setTimeout((function(){t(e,o+1,n)}),100)):"function"==typeof n&&setTimeout(n,700)}!function o(n){void 0===e[n]?setTimeout((function(){o(0)}),1500):n<e[n].length&&t(e[n],0,(function(){setTimeout(o,1500,n+1)}))}(0)}));
|
||||
const scrollLimit=150;var dataText=["full stack developer","web designer","student","gamer","drummer"];function typeWriter(e,t,n){t<e.length?(document.querySelector("header div h1").innerHTML=e.substring(0,t+1)+'<span aria-hidden="true">_</span>',setTimeout((function(){typeWriter(e,t+1,n)}),100)):"function"==typeof n&&setTimeout(n,700)}function StartTextAnimation(e){void 0===dataText[e]?setTimeout((function(){StartTextAnimation(0)}),1500):e<dataText[e].length&&typeWriter(dataText[e],0,(function(){setTimeout(StartTextAnimation,1500,e+1)}))}function getTimelineData(){fetch("/api/timelineData").then((e=>{e.json().then((e=>{}))}))}window.onscroll=()=>{document.body.scrollTop>=150||document.documentElement.scrollTop>=150?document.querySelector("nav").classList.add("scrolled"):document.querySelector("nav").classList.remove("scrolled");let e="";document.querySelectorAll("section").forEach((t=>{const n=t.offsetTop;window.pageYOffset>=n-60&&(e=t.getAttribute("id"))})),document.querySelectorAll("nav ul li a").forEach((t=>{t.classList.remove("active"),t.href.includes(e)&&""!==e?t.classList.add("active"):""===e&&document.querySelector("nav ul li a").classList.add("active")}))},document.addEventListener("DOMContentLoaded",(()=>{StartTextAnimation(0)}));
|
46
gulpfile.js
46
gulpfile.js
@ -1,8 +1,14 @@
|
||||
const gulp = require("gulp");
|
||||
const gulp = require("gulp")
|
||||
const browserSync = require("browser-sync").create();
|
||||
const htmlMin = require("gulp-htmlmin");
|
||||
const cssMin = require("gulp-clean-css")
|
||||
const terser = require("gulp-terser");
|
||||
const ftp = require("vinyl-ftp");
|
||||
const env = require("gulp-env");
|
||||
env({
|
||||
file: ".env",
|
||||
type: ".ini"
|
||||
});
|
||||
|
||||
gulp.task("minifyHTML", () =>
|
||||
{
|
||||
@ -20,8 +26,10 @@ gulp.task("minifyCSS", () =>
|
||||
|
||||
gulp.task("minifyJS", () =>
|
||||
{
|
||||
function createErrorHandler(name) {
|
||||
return function (err) {
|
||||
function createErrorHandler(name)
|
||||
{
|
||||
return function (err)
|
||||
{
|
||||
console.error("Error from " + name + " in compress task", err.toString());
|
||||
};
|
||||
}
|
||||
@ -34,6 +42,32 @@ gulp.task("minifyJS", () =>
|
||||
.on("error", createErrorHandler("gulp.dest"));
|
||||
});
|
||||
|
||||
gulp.task("watch files", () =>
|
||||
{
|
||||
gulp.watch("src/*.html", gulp.task("minifyHTML"));
|
||||
gulp.watch("src/css/*.css", gulp.task("minifyCSS"));
|
||||
gulp.watch("src/js/*.js", gulp.task("minifyJS"));
|
||||
});
|
||||
|
||||
gulp.task("ftp", () =>
|
||||
{
|
||||
let conn = ftp.create(
|
||||
{
|
||||
host: process.env.host,
|
||||
user: process.env.user,
|
||||
pass: process.env.pass,
|
||||
parallel: 1,
|
||||
});
|
||||
return gulp.src("dist/**", {base: "dist", dot: true})
|
||||
.pipe(conn.newer("/"))
|
||||
.pipe(conn.dest("/"));
|
||||
});
|
||||
|
||||
gulp.task("deploy", () =>
|
||||
{
|
||||
gulp.watch("dist", gulp.task("ftp"));
|
||||
});
|
||||
|
||||
gulp.task("browserSync", () =>
|
||||
{
|
||||
browserSync.init({
|
||||
@ -41,11 +75,7 @@ gulp.task("browserSync", () =>
|
||||
baseDir: "dist"
|
||||
}
|
||||
});
|
||||
|
||||
gulp.watch("src/*.html", gulp.task("minifyHTML"));
|
||||
gulp.watch("src/css/*.css", gulp.task("minifyCSS"));
|
||||
gulp.watch("src/js/*.js", gulp.task("minifyJS"));
|
||||
gulp.watch("dist").on("change", browserSync.reload)
|
||||
});
|
||||
|
||||
gulp.task("default", gulp.series("browserSync"));
|
||||
gulp.task("default", gulp.series(gulp.parallel("watch files", "deploy")));
|
||||
|
902
package-lock.json
generated
902
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,10 +15,13 @@
|
||||
"browser-sync": "^2.26.14",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-clean-css": "^4.3.0",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-deploy-ftp": "^1.0.1",
|
||||
"gulp-env": "^0.4.0",
|
||||
"gulp-htmlmin": "^5.0.1",
|
||||
"gulp-terser": "^2.0.1",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"normalize.css": "^8.0.1",
|
||||
"require": "^0.4.4"
|
||||
"require": "^0.4.4",
|
||||
"vinyl-ftp": "^0.6.1"
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +310,6 @@ section#curriculumvitae .cvGrid > div {
|
||||
#curriculumvitae .timelineItem span {
|
||||
color: hsl(0, 0%, 90%);
|
||||
}
|
||||
|
||||
/**** Media Queries *****/
|
||||
|
||||
@media screen and (max-width: 90em) {
|
||||
@ -340,6 +339,7 @@ section#curriculumvitae .cvGrid > div {
|
||||
section#curriculumvitae .cvGrid .timeline {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 75em) {
|
||||
@ -520,6 +520,7 @@ section#curriculumvitae .cvGrid > div {
|
||||
section#about div {
|
||||
padding: 0.1em 2.5em;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media screen and (max-width: 31em) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<title>Rohit Pai - Portfolio</title>
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<script src="https://kit.fontawesome.com/ed3c25598e.js" crossorigin="anonymous"></script>
|
||||
<script src="js/main.js"></script>
|
||||
|
@ -1,5 +1,9 @@
|
||||
// scrolling effect
|
||||
const scrollLimit = 150;
|
||||
|
||||
// array with texts to type in typewriter
|
||||
var dataText = ["full stack developer", "web designer", "student", "gamer", "drummer"];
|
||||
|
||||
window.onscroll = () =>
|
||||
{
|
||||
// check if scrolled past limit if so add scrolled class to change background of nav
|
||||
@ -39,16 +43,19 @@ window.onscroll = () =>
|
||||
});
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () =>
|
||||
{
|
||||
// array with texts to type in typewriter
|
||||
var dataText = ["full stack developer", "web designer", "student", "gamer", "drummer"];
|
||||
// typewriter effect
|
||||
|
||||
// type one text in the typwriter
|
||||
// keeps calling itself until the text is finished
|
||||
function typeWriter(text, i, fnCallback)
|
||||
{
|
||||
// chekc if text isn't finished yet
|
||||
/**
|
||||
* typeWriter function
|
||||
* type one character at a time in the typewriter
|
||||
* keeps calling itself until the text is finished
|
||||
* @param {string} text text to type
|
||||
* @param {number} i current index at which the next character should be typed
|
||||
* @param {function} fnCallback function to call back in this case the StartTextAnimation function
|
||||
*/
|
||||
function typeWriter(text, i, fnCallback)
|
||||
{
|
||||
// check if text isn't finished yet
|
||||
if (i < (text.length))
|
||||
{
|
||||
// add next character to h1
|
||||
@ -66,11 +73,15 @@ document.addEventListener('DOMContentLoaded', () =>
|
||||
// call callback after timeout
|
||||
setTimeout(fnCallback, 700);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// start a typewriter animation for a text in the dataText array
|
||||
function StartTextAnimation(i)
|
||||
{
|
||||
/**
|
||||
* StartTextAnimation function
|
||||
* start a typewriter animation for a text in the dataText array
|
||||
* @param {number} i current index at which text should be typed next
|
||||
*/
|
||||
function StartTextAnimation(i)
|
||||
{
|
||||
if (typeof dataText[i] === "undefined")
|
||||
{
|
||||
setTimeout(function ()
|
||||
@ -87,9 +98,26 @@ document.addEventListener('DOMContentLoaded', () =>
|
||||
setTimeout(StartTextAnimation, 1500, i + 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// cv timeline data
|
||||
|
||||
function getTimelineData()
|
||||
{
|
||||
fetch("/api/timelineData").then(res =>
|
||||
{
|
||||
res.json().then(json =>
|
||||
{
|
||||
console.log(JSON.parse(json));
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () =>
|
||||
{
|
||||
// start the text animation
|
||||
StartTextAnimation(0);
|
||||
});
|
||||
|
||||
// get timeline data and add it to the timeline
|
||||
//getTimelineData();
|
||||
});
|
Loading…
Reference in New Issue
Block a user