--- applyTo: "frontend/**/*" --- # Frontend Instructions These instructions apply to all files in the `frontend/` directory (templates, CSS, JavaScript, images). ## Templates (Jinja2) ### Location and Structure - All templates in `frontend/templates/` - Use template inheritance with `base.html` - Keep templates organized by feature ### Template Patterns ```jinja2 {% extends "base.html" %} {% block title %}Document Upload - DocuElevate{% endblock %} {% block content %}

{{ page_title }}

{% if error_message %}
{{ error_message }}
{% endif %}
{% endblock %} ``` ### Tailwind CSS Usage - Use Tailwind utility classes (already configured) - Follow responsive design: `md:`, `lg:` breakpoints - Use existing color scheme from the project - Common patterns: - Containers: `container mx-auto px-4` - Buttons: `bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded` - Cards: `bg-white shadow-md rounded-lg p-6` - Forms: `w-full px-3 py-2 border rounded` ### Static Files - CSS files in `frontend/static/css/` - JavaScript in `frontend/static/js/` - Images in `frontend/static/images/` - Reference with `{{ url_for('static', path='css/style.css') }}` ### JavaScript - Keep JavaScript minimal - prefer server-side rendering - Use vanilla JavaScript or minimal dependencies - Place scripts at the end of the body - Use `defer` or `async` for external scripts ```html ``` ### Forms - Use CSRF protection when needed - Include proper validation - Show clear error messages - Use proper `method` (GET/POST) and `enctype` for file uploads ```html
``` ### Accessibility (WCAG 2.1 Level AA Required) DocuElevate targets **WCAG 2.1 Level AA** compliance. Every template change **must** follow these rules. For the full guide with examples, see `docs/AccessibilityGuide.md`. #### Semantic HTML (WCAG 1.3.1) - Use semantic elements: `