Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive Classic CSS - Mostly duplicate line removal #6748

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

TMCSherpa
Copy link
Contributor

Mostly duplicate line removal PR split part from #6747

Mostly duplicate line removal PR split part 2
@TMCSherpa
Copy link
Contributor Author

Just so everyone is on the same page, here is a crappy script fusion of what I did
START
#!/bin/bash

cat ./css/stylesheet.css |grep "\S" |paste -s -d ''|tr -s '[:space:]'|sed 's/,\s/,/g '|sed 's/\s,/,/g'|sed 's/\s{/{/g'|sed 's/}\s/}/g'|sed 's/}/}\n/g'|sed 's//*.**///'> ./stylesheet_copy.txt
cat stylesheet_copy.txt| sed 's#{#,\n{#g' > stylesheet_split.txt
cat stylesheet_split.txt |grep { > stylesheet_properties.txt
cat stylesheet_split.txt |grep -v { > stylesheet_elements.txt
rm stylesheet_copy.txt
rm stylesheet_split.txt

x=1
while IFS= read -r line; do
sed -n "$x p" stylesheet_elements.txt|sed "s&,&$line\n&g"|grep "\S" >> stylesheet_per_line.txt
x=$(( $x + 1 ))
done < stylesheet_properties.txt
rm stylesheet_properties.txt
rm stylesheet_elements.txt

cat stylesheet_per_line.txt |sed 's/{.*}//'|sort -u > stylesheet_diff_list.txt

x=1
while IFS= read -r line; do
echo "working on "$line
echo -e "\t" $line >> stylesheet_dup.txt
cat stylesheet_per_line.txt |grep ^"$line"{ >> stylesheet_dup.txt
echo >> stylesheet_dup.txt
x=$(( $x + 1 ))
done < stylesheet_diff_list.txt
rm stylesheet_diff_list.txt
rm stylesheet_per_line.txt

cat ./css/stylesheet_colors.css |grep "\S" |paste -s -d ''|tr -s '[:space:]'|sed 's/,\s/,/g '|sed 's/\s,/,/g'|sed 's/\s{/{/g'|sed 's/}\s/}/g'|sed 's/}/}\n/g'|sed 's//*.**///'> ./stylesheet_colors_copy.txt
cat stylesheet_colors_copy.txt| sed 's#{#,\n{#g' > stylesheet_colors_split.txt
cat stylesheet_colors_split.txt |grep { > stylesheet_colors_properties.txt
cat stylesheet_colors_split.txt |grep -v { > stylesheet_colors_elements.txt
rm stylesheet_colors_copy.txt
rm stylesheet_colors_split.txt

x=1
while IFS= read -r line; do
sed -n "$x p" stylesheet_colors_elements.txt|sed "s&,&$line\n&g"|grep "\S" >> stylesheet_colors_per_line.txt
x=$(( $x + 1 ))
done < stylesheet_colors_properties.txt
rm stylesheet_colors_properties.txt
rm stylesheet_colors_elements.txt

cat stylesheet_colors_per_line.txt |sed 's/{.*}//'|sort -u > stylesheet_colors_diff_list.txt

x=1
while IFS= read -r line; do
echo "working on "$line
echo -e "\t" $line >> stylesheet_colors_dup.txt
cat stylesheet_colors_per_line.txt |grep ^"$line"{ >> stylesheet_colors_dup.txt
echo >> stylesheet_colors_dup.txt
x=$(( $x + 1 ))
done < stylesheet_colors_diff_list.txt
rm stylesheet_colors_diff_list.txt
rm stylesheet_colors_per_line.txt
END

run it in the responsive_clasic folder and look for blocks of lines

from stylesheet
#mainWrapper
#mainWrapper{text-align:left;width:100%;vertical-align:top;}
#mainWrapper{margin:0;padding:0;}
#mainWrapper{margin:auto;} <- overrides margin:0
#mainWrapper{} <- plenty of #mainWrapper lines, does this need to be here?

from stylesheet_colors
#mainWrapper
#mainWrapper{background:#fff;} <- these are both on line 36 for some reason
#mainWrapper{background:#fff;}
#mainWrapper{background:#f4f4f4;} <- line 37 overrides (both) #fff

@drbyte drbyte changed the title Mostly duplicate line removal Responsive Classic CSS - Mostly duplicate line removal Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant