Create nginx replace css stylesheet
I am using nginx with the HttpSubsModule to replace multiple CSS stylesheets for another. My regex
subs_filter '<link(.*)href="(.+\.css)([\?.]?[^"]*)(".*)>' '<link href="new.css" rel="stylesheet" type="text/css">' irg;
It appears to be valid, but subs_filter doesn't work with it. Simpler forms such as
subs_filter (.*)css '<link href="new.css" rel="stylesheet" type="text/css">' irg;
do work, but they catch a lot of false results.
How do I write this regex?
EDIT: The next version works on www.regexe.com replacing any css file link tag, but still doesn't work on nginx.
subs_filter '(<link.*href=")(.+\.css)([\?.]?[^"]*)(".*>)' '$1new.css$3$4' irg;
+3
source to share