This project demonstrates the evolution from a simple Bootstrap demo (Task 1) to a sophisticated templating engine + bundler implementation using modern web development tools.
Nunjucks over Handlebars:
Vite over Gulp:
task2-templating-demo/
βββ src/
β βββ templates/
β β βββ layouts/
β β β βββ base.njk # Base layout template
β β βββ partials/
β β β βββ navigation.njk # Navigation component
β β β βββ footer.njk # Footer component
β β βββ pages/
β β βββ index.njk # Home page template
β β βββ about.njk # About page template
β β βββ contact.njk # Contact page template
β βββ assets/
β βββ css/
β β βββ styles.css # Custom styles
β βββ js/
β β βββ main.js # Main JavaScript file
β βββ images/ # Image assets
βββ dist/ # Compiled output
βββ package.json # Dependencies and scripts
βββ vite.config.js # Vite configuration
βββ README.md # This file
git clone https://github.com/MANCHALA-SRAVAN-KUMAR/task2-templating-demo.git
cd task2-templating-demo
npm install
npm run dev
This will start the development server at http://localhost:3000
with hot reloading enabled.
npm run build
Compiled files will be generated in the dist/
directory.
npm run preview
Script | Description |
---|---|
npm run dev |
Start development server with hot reloading |
npm run build |
Build for production with optimization |
npm run preview |
Preview production build locally |
npm run clean |
Clean the dist directory |
vite.config.js
)The project uses a custom Vite plugin to handle Nunjucks templates:
// Custom Nunjucks plugin for seamless integration
function nunjucksPlugin() {
return {
name: 'vite-plugin-nunjucks',
configureServer(server) {
// Development server with template rendering
},
generateBundle() {
// Production build with template compilation
}
};
}
Global variables available in all templates:
currentYear
: Current year for copyrightsiteName
: Project nameauthor
: Developer nameThe project maintains the responsive design from Task 1 while adding:
Aspect | Task 1 (Bootstrap Demo) | Task 2 (Templating + Bundler) |
---|---|---|
Architecture | Static HTML files | Component-based templates |
Development | Manual file editing | Hot reloading with instant feedback |
Maintainability | Duplicated code | DRY with template inheritance |
Build Process | None | Optimized production builds |
Scalability | Limited | Highly scalable architecture |
Performance | Basic | Optimized with modern tooling |
npm run build
dist/
folder to GitHub Pagesnpm run build
dist
npm run build
dist
This is an educational project, but suggestions and improvements are welcome:
This project is licensed under the MIT License - see the LICENSE file for details.
MANCHALA-SRAVAN-KUMAR
Built with β€οΈ using modern web development tools
This project demonstrates the power of combining templating engines with modern build tools to create maintainable, scalable web applications.