Multiple string replace in multiple files

Hi guys! Got a script:

Dir.glob “/home/alex/SITE/*.html”) do |file_name|
text =
replace=text.gsub!(or22, rep22), “w”) { |file| file.puts replace }

It’s works fine, but second applying somehow makes affected html empty. Could please someone help me? Thanks!

in your code there is an error, a missing parenthesis, try with this:

or22 = 'style.css'
rep22 = 'stylea577.css'
Dir.glob('/home/alex/SITE/*.html') do |file_name|
  text =
  replace = text.gsub!(or22, rep22), 'w') { |file| file.puts replace }

Thanks, but nope.
That’s not it. Just losted while copying.
It’s something about gsub! and nil when no result.
But can’t figure out what I should use instead of gsub in this case…