1) How I solved Madcap crashing because of a clash with the googletagmanager that was caused because Flare uses "defer" when loading the require.min.js script
For details see here viewtopic.php?f=12&t=33034&p=142038#p142038
2) How I run post-processing using WSL/Linux style scripts
I grew up using Unix so I find Poweshell uncomprehensible - so when I had to write a post-process to work around a Flare crashing bug (nudge, nudge, hint, hint, say no more) I wanted to do it using Bash, find and sed. It was quite a challenge for various reasons:
1) I wanted to pass the output folder and needed to change the '\' to '/'
2) When you run bash from a CMD tool it uses a different version of the Unix tools to what runs from my Git installed Bash script
So here is my solution for whats it worth - you can adapt it as necessary - you need to have WSL or some other Linux type environment installed.
The post build command set in the the Project Build Event" tab is as follows:
Code: Select all
cd $(ProjectDirectory)Content\processing
$(ProjectDirectory)Content\processing\postprocessing $(OutputDirectory)
The postprocessing.bat files contains as follows:
Code: Select all
set output1=%1
set output2=%output1:\=/%
echo -%output1%-%output2%- >debug2.txt
bash.exe ./postprocessing.sh %output2%
Code: Select all
echo $1 | sed 's/[cC]:/\/mnt\/c/'`
echo "dir is " `pwd` >debug1.txt
echo "output is $output" >> debug1.txt
find $output -name '*.html' -print >>debug1.txt
find $output -name '*.html' -print0 | xargs -0 sed -i 's/\(require\.min\.js" .*\)defer="defer"/\1/g'
1) converts the C: to /mnt/c (you might need to change it it /c on your system)
2) Writes some debug output (left it here just in case you need to debug it)
3) searches for all the .html files in the output and then removes the defer="defer" from the line that contains require.min.js
It could be improved by making sure that the require.min.js is in a <script> but I'm scared Madcap will change the format to multiple lines or do something else that will make the search fail.
Enjoy !