A modern, responsive, and feature-rich web template inspired by Apple's design philosophy. Built with performance, accessibility, and user experience in mind.
- Apple-inspired Design: Clean, minimalist aesthetic with modern typography (Inter font)
- Dark/Light Mode: Automatic theme switching with user preference storage
- Responsive Layout: Mobile-first design optimized for all devices
- Smooth Animations: CSS animations and JavaScript-powered scroll effects
- Modern Color System: CSS custom properties with comprehensive color palette
- Glass Morphism: Backdrop blur effects for modern UI elements
- Progressive Web App (PWA): Installable with offline functionality
- Service Worker: Advanced caching strategies for optimal performance
- Lazy Loading: Images load only when needed to improve performance
- Code Splitting: Optimized JavaScript loading and execution
- SEO Optimized: Meta tags, structured data, and semantic HTML
- Accessibility: WCAG compliant with proper ARIA labels and focus management
- Interactive Components: Pricing toggle, mobile menu, contact forms
- Form Validation: Real-time validation with user-friendly error messages
- Scroll Animations: Intersection Observer API for smooth reveal effects
- Parallax Effects: Subtle parallax scrolling for enhanced user experience
- Theme Persistence: Remembers user's theme preference across sessions
- Cross-browser Support: Compatible with all modern browsers
- Mobile Menu: Smooth hamburger menu animation
- Touch Optimized: Proper touch targets and gestures
- Fast Loading: Optimized images and resources for mobile networks
- App-like Feel: PWA capabilities for native-like experience
- Node.js (version 16 or higher)
- npm or yarn
- Firebase CLI (for deployment)
-
Clone the repository
git clone <your-repo-url> cd webtemplate2
-
Install dependencies
npm install
-
Install Firebase CLI (if not already installed)
npm install -g firebase-tools
npm run dev- Starts browser-sync server at
http://localhost:3000 - Automatic browser refresh on file changes
- Synchronized scrolling and interactions across devices
npm start- Simple Node.js Express server at
http://localhost:3000 - Good for testing server-side functionality
firebase serve- Test Firebase hosting configuration locally
- Simulates production environment
webtemplate2/
βββ π index.html # Main HTML file with semantic structure
βββ π¨ style.css # Enhanced CSS with modern features
βββ β‘ script.js # Advanced JavaScript functionality
βββ π¦ package.json # Dependencies and build scripts
βββ π₯ firebase.json # Firebase hosting configuration
βββ βοΈ .firebaserc # Firebase project settings
βββ π± manifest.json # PWA configuration
βββ π§ service-worker.js # Advanced service worker
βββ π« 404.html # Custom error page
βββ π₯οΈ server.js # Local development server
βββ π public/ # Firebase default files
βββ πΌοΈ assets/ # Images and media files
βββ π README.md # This documentation
-
Logo & Brand Name
<!-- Update in index.html --> <div class="logo"> <svg>...</svg> <span>YourBrand</span> </div>
-
Colors & Theme
/* Update in style.css */ :root { --primary-color: #007AFF; /* Your brand color */ --secondary-color: #5856D6; /* Accent color */ /* ... more colors */ }
-
Typography
/* Change font in style.css */ :root { --font-family: 'Your-Font', Inter, sans-serif; }
-
Hero Section
<!-- Customize hero content --> <h1 class="hero-title"> <span class="gradient-text">Your</span><br> <span>Message</span> </h1>
-
Hero Background
.hero-background::before { background: url('your-hero-image.jpg') center/cover; }
-
Showcase Images
- Replace Unsplash URLs with your own images
- Maintain aspect ratios for best results
- Use WebP format for better performance
-
Favicon & Icons
- Replace
favicon.pngin the root directory - Update
manifest.jsonwith your icon paths
- Replace
-
Contact Form
<!-- Update action URL --> <form action="https://formspree.io/f/YOUR_FORM_ID" method="POST">
-
Alternative Form Services
- Netlify Forms: Add
netlifyattribute - EmailJS: Integrate with JavaScript
- Custom API: Update form handler in script.js
- Netlify Forms: Add
- Update Pricing Plans
<div class="pricing-card"> <h3>Your Plan</h3> <div class="price"> <span class="amount monthly-price">99</span> <span class="amount yearly-price" style="display: none;">79</span> </div> <!-- Features list --> </div>
-
Setup Firebase
firebase login firebase init hosting
-
Configure firebase.json
{ "hosting": { "public": ".", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } } -
Deploy
firebase deploy
npm i -g vercel
vercel --prod# Drag and drop the project folder
# Or connect GitHub repository# Enable Pages in repository settings
# Deploy from main branch- Image Optimization: Lazy loading and WebP format
- CSS Optimization: CSS custom properties and efficient selectors
- JavaScript: Throttled scroll events and debounced resize handlers
- Service Worker: Intelligent caching strategies
- Font Loading: Preconnect and font-display swap
-
Google Analytics
<!-- Add before closing </head> --> <script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'GA_TRACKING_ID'); </script>
-
Performance Monitoring
- Web Vitals automatically measured
- Service Worker performance logging
- Console performance metrics
Add to your hosting provider:
Content-Security-Policy: default-src 'self' https:; script-src 'self' 'unsafe-inline' https:; style-src 'self' 'unsafe-inline' https:;
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
-
Add language files
const translations = { en: { /* English translations */ }, es: { /* Spanish translations */ } };
-
Update HTML lang attribute
<html lang="en" dir="ltr">
-
Custom Install Prompt
// Add to script.js window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); // Show custom install UI });
-
Background Sync
// Form submissions work offline navigator.serviceWorker.register('/service-worker.js') .then(registration => { return registration.sync.register('contact-form'); });
- All sections scroll smoothly
- Dark/light mode toggle works
- Forms validate correctly
- Mobile menu functions properly
- Images load with lazy loading
- PWA installs correctly
- Offline functionality works
# Lighthouse CI
npm install -g @lhci/cli
lhci autorun
# Performance testing
npm run test:performance-
Service Worker Not Updating
// Force update navigator.serviceWorker.getRegistration().then(reg => { reg.update(); });
-
Images Not Loading
- Check CORS headers
- Verify image URLs
- Test lazy loading implementation
-
Dark Mode Not Persisting
- Check localStorage availability
- Verify theme application logic
-
Mobile Menu Not Working
- Ensure JavaScript is enabled
- Check for console errors
- Verify event listeners
Add to URL: ?debug=true
- Shows performance metrics
- Enables verbose logging
- Displays debug information
| Browser | Version | Support |
|---|---|---|
| Chrome | 90+ | β Full |
| Firefox | 88+ | β Full |
| Safari | 14+ | β Full |
| Edge | 90+ | β Full |
| Mobile Safari | 14+ | β Full |
| Chrome Mobile | 90+ | β Full |
- CSS Grid β Flexbox fallback
- CSS Custom Properties β SCSS variables
- IntersectionObserver β scroll event fallback
- Service Worker β AppCache fallback (legacy)
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
- Follow existing code style
- Add comments for complex logic
- Test across multiple browsers
- Optimize for performance
- Maintain accessibility standards
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
- Live Demo: https://webtemplate-2-fm.web.app/
- Firebase Console: Firebase Project
- Formspree: Form handling service
- Unsplash: Free stock photos
- Inter Font: Google Fonts
- Lighthouse Score: 95+ (Performance, Accessibility, Best Practices, SEO)
- First Contentful Paint: < 1.5s
- Largest Contentful Paint: < 2.5s
- Cumulative Layout Shift: < 0.1
- First Input Delay: < 100ms
Built with β€οΈ using modern web technologies
Ready to create amazing digital experiences! π