102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/antoinette/cli/commands.rb', line 102
def call(**)
out = Antoinette::CLI.output
config_path = Rails.root.join("config", "antoinette.json")
config = JSON.parse(File.read(config_path))
clearer = Antoinette::ClearScriptTag.new
config["bundles"].each do |bundle|
out.puts "Clearing bundle: #{bundle["name"]}"
bundle_file = Rails.root.join(
"app", "assets", "javascripts", "antoinette", "#{bundle["name"]}.js"
)
if File.exist?(bundle_file)
File.delete(bundle_file)
out.puts " Deleted bundle file: #{bundle["name"]}.js"
end
bundle["templates"].each do |template_path|
clearer.clear(template_path: template_path)
end
out.puts " Cleared script tags from #{bundle["templates"].length} template(s)"
end
out.puts "Clear complete!"
end
|