mirror of
https://github.com/opnsense/plugins.git
synced 2026-04-15 22:20:31 -04:00
misc/theme-flexcolor: inject css into files that are cache safe
This is a bit weird, but lets us inline the branding CSS and the cache invalidation for CSS works fine.
This commit is contained in:
parent
a696ef090f
commit
9ebf053b8e
10 changed files with 12 additions and 5 deletions
|
|
@ -22,13 +22,20 @@ CACHEMARKER="/usr/local/opnsense/www/index.php"
|
|||
flexcolor_start()
|
||||
{
|
||||
SELECTEDCSS="${SCHEMESDIR}/${flexcolor_theme}/${DEFAULTCSS}"
|
||||
if [ ! -f "${SELECTEDCSS}" ]; then
|
||||
warn "The theme '${flexcolor_theme}' was not found."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -f "${SELECTEDCSS}" ]; then
|
||||
cp "${SELECTEDCSS}" "${TARGETDIR}/${DEFAULTCSS}"
|
||||
for FILE in $(find ${TARGETDIR} -name "*.sample"); do
|
||||
FILE=${FILE%.sample}
|
||||
cp ${FILE}.sample ${FILE}
|
||||
sed -i '' -e "/@import url('default_scheme.css');/r ${SELECTEDCSS}" ${FILE}
|
||||
sed -i '' -e "/@import url('default_scheme.css');/d" ${FILE}
|
||||
done
|
||||
|
||||
if [ -f "${CACHEMARKER}" ]; then
|
||||
touch "${CACHEMARKER}"
|
||||
fi
|
||||
if [ -f "${CACHEMARKER}" ]; then
|
||||
touch "${CACHEMARKER}"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue