Skip to content

Commit ec5fcda

Browse files
authored
Merge pull request #44 from PatilShreyas/optimization
Optimize site performance
2 parents d7a3f8a + 614c12e commit ec5fcda

File tree

14 files changed

+515
-73
lines changed

14 files changed

+515
-73
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Hugo site to Pages
1+
name: Deploy to Pages
22

33
on:
44
push:
@@ -47,8 +47,6 @@ jobs:
4747
- name: Setup Pages
4848
id: pages
4949
uses: actions/configure-pages@v4
50-
- name: Install Node.js dependencies
51-
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
5250
- name: Build with Hugo
5351
env:
5452
# For maximum backward compatibility with Hugo modules

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ A modern, minimalist portfolio website built with Hugo.
1717

1818
### Prerequisites
1919
- [Hugo Extended](https://gohugo.io/installation/) (v0.148.2 or later)
20-
- Node.js (for Tailwind CSS)
20+
- [Node.js](https://nodejs.org/) (v16 or later)
21+
- npm (comes with Node.js)
2122

22-
### Local Development
23+
### Local Development Setup
2324
```bash
2425
# Clone the repository
2526
git clone https://github.com/PatilShreyas/PatilShreyas.github.io.git
@@ -31,28 +32,56 @@ hugo server
3132
# Site will be available at http://localhost:1313
3233
```
3334

35+
### CSS Development (Optional)
36+
If you need to modify Tailwind CSS:
37+
38+
```bash
39+
# Install dependencies (only needed for CSS changes)
40+
npm install
41+
42+
# Build optimized CSS after making Tailwind changes
43+
npm run build-css
44+
45+
# Commit the generated CSS file
46+
git add static/css/tailwind.css
47+
git commit -m "Update optimized CSS"
48+
```
49+
50+
### Available npm Scripts (Development Only)
51+
```bash
52+
npm run build-css # Build optimized Tailwind CSS
53+
npm run watch-css # Watch for changes and rebuild CSS
54+
npm run build # Build both CSS and Hugo site
55+
```
56+
57+
### CSS Development Notes
58+
- **Source:** `src/input.css` (Tailwind directives and custom CSS)
59+
- **Output:** `static/css/tailwind.css` (committed to repository)
60+
- **Config:** `tailwind.config.js` (Tailwind configuration)
61+
- **Deployment:** CSS is pre-generated and committed, no build step needed
62+
3463
### Building for Production
3564
```bash
36-
# Build the site
3765
hugo --minify
3866

3967
# Output will be in the 'public/' directory
4068
```
4169

4270
## 🚀 Deployment
4371

72+
Both deployment platforms are configured for simple Hugo-only builds (no Node.js dependencies required).
73+
4474
### GitHub Actions (Recommended)
45-
The repository includes GitHub Actions workflow for automatic deployment:
75+
The repository includes GitHub Actions workflow for automatic deployment with optimized builds:
4676

47-
[.github/workflows/hugo.yml](.github/workflows/hugo.yml)
77+
[.github/workflows/deploy-to-pages.yml](.github/workflows/deploy-to-pages.yml)
4878

4979
### Netlify
5080
Current deployment is on Netlify with automatic builds from the main branch.
5181
Configured in [netlify.toml](netlify.toml).
5282

5383
### Manual Deployment
5484
```bash
55-
# Build the site
5685
hugo --minify
5786

5887
# Deploy the 'public/' directory to your hosting provider

hugo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ disableKinds = ["taxonomy", "term"]
1313
# Profile information
1414
name = "Shreyas Sharad Patil"
1515
tagline = "Google Developer Expert for Android"
16-
profile_image = "/Images/profile.png"
16+
profile_image = "/Images/profile-optimized.webp"
1717
cv_url = "https://drive.google.com/file/d/1RMyErD4VNG2IhoHghwugXm0PGAxcGL0m/view?usp=sharing"
1818

1919
# Social media links
2020
email = "hi@shreyaspatil.dev"
2121
facebook = "https://www.facebook.com/shreyaspatil99"
2222
twitter = "https://twitter.com/imShreyasPatil"
2323
instagram = "https://instagram.com/shreyaspatil.dev/"
24+
threads = "https://www.threads.net/@shreyaspatil.dev"
2425
linkedin = "https://www.linkedin.com/in/patil-shreyas"
2526
github = "https://github.com/PatilShreyas"
2627
playstore = "https://play.google.com/store/apps/dev?id=7315706573700759915"

layouts/_default/baseof.html

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<meta name="keywords" content="{{ .Site.Params.keywords }}">
1111
<meta name="author" content="{{ .Site.Params.author }}">
1212
<link rel="canonical" href="{{ .Permalink }}" />
13-
<link rel="shortcut icon" href="{{ .Site.BaseURL }}Images/profile.png" type="image/png" />
13+
<link rel="shortcut icon" href="{{ .Site.BaseURL }}Images/profile-optimized.png" type="image/png" />
1414

1515
<!-- Open Graph -->
1616
<meta property="og:title" content="{{ .Site.Title }}">
17-
<meta property="og:image" content="{{ .Site.BaseURL }}Images/profile.png">
17+
<meta property="og:image" content="{{ .Site.BaseURL }}Images/profile-optimized.png">
1818
<meta property="og:description" content="{{ .Site.Params.description }}">
1919
<meta property="og:url" content="{{ .Permalink }}">
2020
<meta property="og:type" content="website">
@@ -23,39 +23,21 @@
2323
<meta name="twitter:card" content="summary_large_image">
2424
<meta name="twitter:title" content="{{ .Site.Title }}">
2525
<meta name="twitter:description" content="{{ .Site.Params.description }}">
26-
<meta name="twitter:image" content="{{ .Site.BaseURL }}Images/profile.png">
26+
<meta name="twitter:image" content="{{ .Site.BaseURL }}Images/profile-optimized.png">
2727

2828
<!-- Resource Hints -->
2929
<link rel="preconnect" href="https://fonts.googleapis.com">
3030
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
31-
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
32-
<link rel="preconnect" href="https://cdn.tailwindcss.com">
31+
32+
<!-- Preload Critical Resources -->
33+
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" as="style" onload="this.onload=null;this.rel='stylesheet'">
34+
<noscript><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap"></noscript>
35+
<link rel="preload" href="{{ .Site.BaseURL }}{{ .Site.Params.profile_image }}" as="image">
36+
<link rel="preload" href="{{ .Site.BaseURL }}Images/background-optimized.webp" as="image">
3337

3438
<!-- Fonts and CSS -->
35-
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap" rel="stylesheet">
36-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
37-
<script src="https://cdn.tailwindcss.com"></script>
38-
<script>
39-
tailwind.config = {
40-
darkMode: 'class',
41-
theme: {
42-
extend: {
43-
colors: {
44-
primary: '#47d3f7',
45-
dark: {
46-
bg: '#000000',
47-
card: 'rgba(255, 255, 255, 0.05)',
48-
text: '#ffffff',
49-
muted: '#b7b6bb'
50-
}
51-
},
52-
fontFamily: {
53-
'montserrat': ['Montserrat', 'sans-serif']
54-
}
55-
}
56-
}
57-
}
58-
</script>
39+
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/fontawesome-minimal.css">
40+
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/tailwind.css">
5941
<link rel="stylesheet" href="{{ .Site.BaseURL }}css/custom.css">
6042
</head>
6143
<body class="dark bg-dark-bg text-dark-text font-montserrat">
@@ -72,19 +54,25 @@
7254

7355
<!-- Image Loading Optimization Script -->
7456
<script>
75-
// Load background image after page is fully loaded
76-
window.addEventListener('load', function() {
77-
setTimeout(function() {
78-
const bgElement = document.getElementById('background-image');
79-
if (bgElement) {
80-
const img = new Image();
81-
img.onload = function() {
82-
bgElement.style.backgroundImage = "url('/Images/background.png')";
83-
bgElement.style.opacity = '1';
84-
};
85-
img.src = '/Images/background.png';
86-
}
87-
}, 1000);
57+
// Load background image with WebP support and fallback
58+
document.addEventListener('DOMContentLoaded', function() {
59+
const bgElement = document.getElementById('background-image');
60+
if (bgElement) {
61+
// Check WebP support and use appropriate image
62+
const webpSupported = (function() {
63+
const canvas = document.createElement('canvas');
64+
canvas.width = 1;
65+
canvas.height = 1;
66+
return canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0;
67+
})();
68+
69+
const imageUrl = webpSupported
70+
? '/Images/background-optimized.webp'
71+
: '/Images/background-optimized.jpg';
72+
73+
bgElement.style.backgroundImage = `url('${imageUrl}')`;
74+
bgElement.style.opacity = '1';
75+
}
8876
});
8977
</script>
9078

layouts/index.html

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
<div id="home" class="flex-1 lg:flex-none lg:w-2/5 flex items-center justify-center px-4 py-20 lg:py-0">
1515
<div class="text-center max-w-lg">
1616
<!-- Profile Image with Loading Placeholder -->
17-
<div class="mb-8 relative">
17+
<div class="mb-8 mt-8 relative">
1818
<!-- Placeholder circle while image loads -->
1919
<div id="profile-placeholder" class="w-48 h-48 lg:w-64 lg:h-64 rounded-full mx-auto shadow-2xl bg-gradient-to-br from-primary to-blue-600 opacity-30 animate-pulse transition-opacity duration-500"></div>
20-
<!-- Actual profile image -->
21-
<img id="profile-image"
22-
src="{{ .Site.Params.profile_image }}"
23-
alt="{{ .Site.Params.name }}"
24-
class="w-48 h-48 lg:w-64 lg:h-64 rounded-full mx-auto shadow-2xl border-2 border-secondary hover:scale-105 transition-all duration-500 opacity-0 absolute inset-0"
25-
onload="this.style.opacity='1'; document.getElementById('profile-placeholder').style.opacity='0';">
20+
<!-- Actual profile image with WebP support -->
21+
<picture id="profile-image" class="opacity-0 absolute inset-0 transition-opacity duration-500">
22+
<source srcset="{{ .Site.Params.profile_image }}" type="image/webp">
23+
<img src="/Images/profile-optimized.png"
24+
alt="{{ .Site.Params.name }}"
25+
class="w-48 h-48 lg:w-64 lg:h-64 rounded-full mx-auto shadow-2xl border-2 border-secondary hover:scale-105 transition-all duration-500"
26+
onload="this.parentElement.style.opacity='1'; document.getElementById('profile-placeholder').style.opacity='0';">
27+
</picture>
2628
</div>
2729

2830
<!-- Name -->
@@ -32,7 +34,7 @@ <h1 class="text-2xl md:text-3xl lg:text-4xl mb-4 text-white font-weight-normal">
3234

3335
<!-- Animated Headlines -->
3436
<div class="mb-8">
35-
<h2 class="text-xl md:text-2xl font-medium text-secondary">
37+
<h2 class="text-xl md:text-2xl font-medium">
3638
<span id="animated-text">❤️ Android</span>
3739
<span class="animate-pulse">|</span>
3840
</h2>
@@ -56,29 +58,24 @@ <h2 class="text-xl md:text-2xl font-medium text-secondary">
5658
<i class="far fa-envelope"></i>
5759
</a>
5860
{{ end }}
59-
{{ with .Site.Params.facebook }}
60-
<a href="{{ . }}" target="_blank" class="social-icon bg-blue-600 hover:bg-blue-700">
61-
<i class="fab fa-facebook-f"></i>
61+
{{ with .Site.Params.github }}
62+
<a href="{{ . }}" target="_blank" class="social-icon bg-gray-600 hover:bg-gray-700">
63+
<i class="fab fa-github-alt"></i>
6264
</a>
6365
{{ end }}
6466
{{ with .Site.Params.twitter }}
65-
<a href="{{ . }}" target="_blank" class="social-icon bg-blue-400 hover:bg-blue-500">
66-
<i class="fab fa-twitter"></i>
67-
</a>
68-
{{ end }}
69-
{{ with .Site.Params.instagram }}
70-
<a href="{{ . }}" target="_blank" class="social-icon bg-pink-600 hover:bg-pink-700">
71-
<i class="fab fa-instagram"></i>
67+
<a href="{{ . }}" target="_blank" class="social-icon bg-black hover:bg-gray-800">
68+
<span class="font-bold text-lg">𝕏</span>
7269
</a>
7370
{{ end }}
7471
{{ with .Site.Params.linkedin }}
7572
<a href="{{ . }}" target="_blank" class="social-icon bg-blue-800 hover:bg-blue-900">
7673
<i class="fab fa-linkedin-in"></i>
7774
</a>
7875
{{ end }}
79-
{{ with .Site.Params.github }}
80-
<a href="{{ . }}" target="_blank" class="social-icon bg-gray-800 hover:bg-gray-900">
81-
<i class="fab fa-github-alt"></i>
76+
{{ with .Site.Params.threads }}
77+
<a href="{{ . }}" target="_blank" class="social-icon bg-gray-900 hover:bg-black">
78+
<span class="font-bold text-lg">@</span>
8279
</a>
8380
{{ end }}
8481
{{ with .Site.Params.playstore }}
@@ -96,6 +93,16 @@ <h2 class="text-xl md:text-2xl font-medium text-secondary">
9693
<i class="fas fa-blog"></i>
9794
</a>
9895
{{ end }}
96+
{{ with .Site.Params.facebook }}
97+
<a href="{{ . }}" target="_blank" class="social-icon bg-blue-600 hover:bg-blue-700">
98+
<i class="fab fa-facebook-f"></i>
99+
</a>
100+
{{ end }}
101+
{{ with .Site.Params.instagram }}
102+
<a href="{{ . }}" target="_blank" class="social-icon bg-pink-600 hover:bg-pink-700">
103+
<i class="fab fa-instagram"></i>
104+
</a>
105+
{{ end }}
99106
</div>
100107
</div>
101108
</div>

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "shreyas-patil-portfolio",
3+
"version": "1.0.0",
4+
"description": "Personal portfolio website of Shreyas Patil - Google Developer Expert for Android",
5+
"scripts": {
6+
"build-css": "tailwindcss -i ./src/input.css -o ./static/css/tailwind.css --minify",
7+
"watch-css": "tailwindcss -i ./src/input.css -o ./static/css/tailwind.css --watch",
8+
"dev": "hugo server --bind 0.0.0.0 --port 1313",
9+
"build": "npm run build-css && hugo --minify"
10+
},
11+
"devDependencies": {
12+
"tailwindcss": "^3.4.0",
13+
"@tailwindcss/forms": "^0.5.7",
14+
"@tailwindcss/typography": "^0.5.10"
15+
},
16+
"keywords": ["hugo", "portfolio", "tailwindcss", "android", "developer"],
17+
"author": "Shreyas Patil",
18+
"license": "MIT"
19+
}

0 commit comments

Comments
 (0)