k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
981 stars 59 forks source link

Support sass-embedded #196

Closed ntkme closed 2 years ago

ntkme commented 2 years ago

Fixes #195.

In sass-embedded, it is protobuf returning frozen string as result. While we could unfreeze it after we get the result in upstream libraries e.g. sass-embedd or tilt, it is intentionally left frozen for best performance. Therefore, this PR updates the code to conditionally use .gsub vs .gsub!. I did a benchmark locally and it is consistently at least around 5% faster than (+text).gsub! on my machine.