git trick for compiled CSS
Hi, I'd like to share a trick. When generating compiled CSS files, no way to check the git diff since all is on one line. I've managed to find a trick : git show --word-diff shows chucks deleted/added so with some regexp : git show --word-diff $SHA1 | egrep '(\[\-)|(\{\+)' | sed -r 's/^.*(\[\-.*\-\]\{\+.*\+\}).*$/\1/g' For example : aebd3f6a53 Bug 27566: Compiled CSS [-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+} [-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+} [-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+} [-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+} This is very usefull to check that compilation worked and did not broke the 90% of the file XD Best regards :D -- Fridolin SOMERS <fridolin.somers@biblibre.com> Software and system maintainer 🦄 BibLibre, France
Hi Frido, This nice trick made me wonder if git could beautify the css before making the diff... and of course it does! https://scripter.co/git-diff-minified-js-and-css/ It requires installing a node package and modifying some git files, but it works really well Le 29/04/2021 à 17:19, Fridolin SOMERS a écrit :
Hi,
I'd like to share a trick.
When generating compiled CSS files, no way to check the git diff since all is on one line.
I've managed to find a trick :
git show --word-diff shows chucks deleted/added so with some regexp :
git show --word-diff $SHA1 | egrep '(\[\-)|(\{\+)' | sed -r 's/^.*(\[\-.*\-\]\{\+.*\+\}).*$/\1/g'
For example :
aebd3f6a53 Bug 27566: Compiled CSS
[-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+}
[-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+}
[-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+}
[-textarea{font-family:NotoSans}.navbar-]{+textarea{font-family:NotoSans,sans-serif}.navbar+}
This is very usefull to check that compilation worked and did not broke the 90% of the file XD
Best regards :D
-- Julian Maurice BibLibre
Thanks! Great tricks. Added to the wiki: https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff... -- Victor Grousset/tuxayo
participants (3)
-
Fridolin SOMERS -
Julian Maurice -
Victor Grousset/tuxayo