-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread_swiper_css.py
More file actions
28 lines (21 loc) · 1002 Bytes
/
read_swiper_css.py
File metadata and controls
28 lines (21 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Debugging why CSS isn't taking effect.
# I'll print all occurrences of `.swiper-slide` in index.html.
import re
with open('index.html', 'r', encoding='utf-8') as f:
html = f.read()
print(f"Total length: {len(html)}")
# Find all matches of .swiper-slide definition
matches = re.findall(r'(\.swiper-slide\s*\{[^}]*\})', html, re.DOTALL)
print(f"Found {len(matches)} CSS blocks for .swiper-slide:")
for i, m in enumerate(matches):
print(f"--- Block {i+1} ---")
print(m)
print("----------------")
# Also check for inline styles on the elements themselves (in case Swiper added them in HTML source?)
# Swiper adds them at runtime, so they won't be in the file unless saved from browser.
# But I should check the HTML markup for `style="..."`.
inline_styles = re.findall(r'<div[^>]*class="[^"]*swiper-slide[^"]*"[^>]*style="([^"]*)"', html)
if inline_styles:
print(f"Found {len(inline_styles)} swiper-slides with inline styles:")
for s in inline_styles[:3]:
print(s)