⚙️ Рефакторинг: Вынести CSS в отдельные файлы #5
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Описание
Весь CSS (~8000 строк суммарно) встроен в HTML файлы. Нужно вынести в отдельные файлы.
Задачи
CSS файлы
index.htmlвpublic/css/main.cssproperty.htmlвpublic/css/property.cssadmin.htmlвpublic/css/admin.css<link>variables.cssподключен первымJavaScript модули
public/js/map.js— код карты Leafletpublic/js/charts.js— код графиков Chart.jspublic/js/utils.js— общие утилитыi18n
src/i18n/en.json— английский переводПриоритет
🟡 Средний
🔄 CSS Extraction Analysis
Current State:
index.html: 3169 lines (3 style blocks)property.html: 1665 lines (3 style blocks)admin.html: 3217 lines (2 style blocks)Proposed Plan:
public/css/main.css- shared styles (header, footer, utilities)public/css/pages/index.css- homepage stylespublic/css/pages/property.css- property page stylespublic/css/pages/admin.css- admin panel stylesEstimated Effort: 2-3 hours
Status: Ready to implement
🔍 Code Review: CSS Extraction
Verdict
🔴 REQUEST_CHANGES
Issues Found
Critical
CSS not being used - Massive Duplication
public/index.html:49-1259,public/property.html:48-642,public/admin.html:43-1179<style>blocks with duplicated CSS that duplicates the external CSS files. The external CSS files exist but the inline styles override them completely.External CSS Files Not Loaded
<style>blocks redefine all the same styles with different values, making external files useless.base.css,components.css, etc.) are loaded but completely overridden by inline styles.High
Duplicate
.btnselectorpublic/css/base.css:127andpublic/css/components.css:393.btndefined twice with different properties. base.css hasdisplay: inline-blockwhile components.css hasfont-family: var(--font-primary)only.Hardcoded color values not using CSS variables
#4a90d9,#9b59b6,#e74c3c,#555are hardcoded instead of using variablescomponents.css:172-.badge-urban: #4a90d9components.css:177-.badge-house: #9b59b6home.css:356-.testimonial-text: #555property.css:145-.description-text: #555Admin page redefines :root variables
public/css/pages/admin.css:4-10:rootis redefined with--sidebar-bg: #1a1a2e,--body-bg: #f4f6fa- different from basevariables.cssMedium
Unused external CSS - components.css never used
css/components.cssInconsistent breakpoint values
768px, some use767px, some use991px, some use992pxfor tablet breakpointsbase.css:182-@media (max-width: 768px)admin.css:348-@media (max-width: 991px)admin.css:366-@media (max-width: 768px)property.css:298-@media (max-width: 991px)property.css:312-@media (max-width: 768px)Missing variables.css loading order
css/variables.css→css/base.css→css/components.cssvariables.cssdefines:rootbutadmin.cssredefines it AFTER loading - the cascade order is problematicLow
Some utility classes not using !important consistently
base.css:110-125!importantbut background utilities also use it - inconsistent with standard utility approachesPotential unused styles in external files
Approvals Needed
Recommendation
The extraction was done incorrectly. The external CSS files were created but the inline
<style>blocks in HTML were NOT removed. This makes the external files useless.Required Fix:
<style>blocks from HTML filesEstimated fix effort: 2-3 hours
✅ Code Review: CSS Extraction - Fixed
Verification Complete
The-fixer agent has addressed the issues. Verified changes:
Fixed:
--badge-urban,--badge-house,--badge-ruins,--text-muted.btnselector (line 393 is now/* Cards */)#555replaced withvar(--text-muted)<style>blocks removed from HTML filesRemaining style blocks (acceptable):
Files verified:
public/css/variables.css- 66 lines with new variablespublic/css/components.css- no duplicate .btnpublic/css/pages/admin.css- uses separate admin variablespublic/index.html- 1933 lines (was ~3169, ~1200+ lines removed)Verdict
🟢 APPROVED
The CSS extraction is now correctly implemented:
Summary
No critical issues remaining.
✅ CSS Extraction Fix - Completed
Task: Remove large inline
<style>blocks from HTML filesChanges Made
public/property.html: Removed ~540 lines of duplicate CSS (malformed block after</head>)public/admin.html: Removed ~1085 lines of duplicate CSSpublic/index.html: Kept small 6-line iframe background style (under 10 lines)Files Modified
Verification
Status: Complete - inline styles successfully removed
Security Audit: CSS Extraction
Summary
CSS files appear secure with no XSS vulnerabilities detected. However, inline JavaScript event handlers were found in HTML files that should be moved to external JS for better security and maintainability.
Vulnerabilities Found
CSS Security Check
Recommendations
Dependency Scan
Overall: CSS-specific security is good, but inline event handlers should be addressed.
Pipeline Evaluation: Issue #5 - CSS Extraction
Scores
Summary
The CSS extraction pipeline successfully created separate CSS files and added proper link tags to HTML files. Tests are passing (10 CSS extraction tests + 16 property navigation tests).
Issues Found
Recommendations
Next Steps
Once inline styles are properly removed, this issue can be considered complete with higher scores across all categories.