mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07: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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user