SWI-Prolog/swish

make min on MacOS

Closed this issue · 9 comments

make min on MacOs 10.15.2 not working with this error

sed -i 's@//# sourceMappingURL=swish-min.js.new.map@//# sourceMappingURL=swish-min.js.map@' swish-min.js.new
sed: 1: "swish-min.js.new": unterminated substitute in regular 

The reason is that sed in MacOs is BSD, not GNU.
Problem solved by installing gnu sed with brew and replacing sed in Makefile with gsed

Thanks. What is really going wrong though? Is BSD sed not allowing for an arbitrary pattern start/end
(the @) character? In that case it might make more sense to escape the /.

Not sure what is happening, tried to search on web but no clear answer.
What is the meaning of the double slash?

Have to have a look, but it is probably just part of the pattern. It is also the typical regex delimiter, but at least GNU sed allows using any character so that you can avoid the need to escape inside the pattern. You can also do 's/\/\/ .../.../' AFAIK.

I tried 's/\/\/ .../.../' and it works

Ok. Updated.

Sorry Jan,
it is not working, I was wrong, I'm trying to understand why.

For gnu sed sed, you have to use


sed -i'' 's/\/\/# sourceMappingURL=swish-min.js.new.map/\/\/# sourceMappingURL=swish-min.js.map/' swish-min.js.new

for Mac sed it should

sed -i '' 's/\/\/# sourceMappingURL=swish-min.js.new.map/\/\/# sourceMappingURL=swish-min.js.map/' swish-min.js.new

They differ by one space

yes, it is working now