lib/jekyll/webpack.rb in jekyll-webpack-0.2.4 vs lib/jekyll/webpack.rb in jekyll-webpack-0.2.5

- old
+ new

@@ -34,11 +34,13 @@ def self.cleanup(site) cleanup_files = site.config.dig('webpack', 'cleanup_files') if cleanup_files array_or_scalar(cleanup_files) do |dest_for_clean| - if Dir.exists?(File.expand_path(dest_for_clean, site.dest)) - FileUtils.rm_rf(File.expand_path(dest_for_clean, site.dest)) + path = File.expand_path(dest_for_clean, site.dest) + + if File.exists?(path) || Dir.exists?(path) + FileUtils.rm_rf(path) end end end end