Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,11 @@
|
|
1 |
import re
|
2 |
import streamlit as st
|
3 |
from bs4 import BeautifulSoup
|
4 |
-
from pathlib import Path
|
5 |
|
6 |
# Streamlit App
|
7 |
st.title("HTML to Twig and SCSS Converter")
|
8 |
|
9 |
# Functions to parse variables and convert CSS to SCSS
|
10 |
-
|
11 |
def parse_variable_file(variable_content):
|
12 |
"""Parses the SCSS variable content and returns a mapping of color names to their values."""
|
13 |
variables = {}
|
@@ -18,7 +16,6 @@ def parse_variable_file(variable_content):
|
|
18 |
variables[match.group(2)] = f"${match.group(1)}" # Color value as key, variable name as value
|
19 |
return variables
|
20 |
|
21 |
-
|
22 |
def convert_css_to_scss(css_content, variable_mapping):
|
23 |
"""Converts CSS content to SCSS by replacing color values with variable names."""
|
24 |
for color, variable in variable_mapping.items():
|
|
|
1 |
import re
|
2 |
import streamlit as st
|
3 |
from bs4 import BeautifulSoup
|
|
|
4 |
|
5 |
# Streamlit App
|
6 |
st.title("HTML to Twig and SCSS Converter")
|
7 |
|
8 |
# Functions to parse variables and convert CSS to SCSS
|
|
|
9 |
def parse_variable_file(variable_content):
|
10 |
"""Parses the SCSS variable content and returns a mapping of color names to their values."""
|
11 |
variables = {}
|
|
|
16 |
variables[match.group(2)] = f"${match.group(1)}" # Color value as key, variable name as value
|
17 |
return variables
|
18 |
|
|
|
19 |
def convert_css_to_scss(css_content, variable_mapping):
|
20 |
"""Converts CSS content to SCSS by replacing color values with variable names."""
|
21 |
for color, variable in variable_mapping.items():
|