Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions lib/simplecov-tailwindcss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ def initialize
end

def format(result)
Dir[File.join(File.dirname(__FILE__), "../public/*")].each do |path|
FileUtils.cp_r(path, asset_output_path)
end

File.open(File.join(output_path, "index.html"), "wb") do |file|
file.puts template("main").result(binding)
end
Expand Down Expand Up @@ -63,19 +59,6 @@ def output_path
SimpleCov.coverage_path
end

def asset_output_path
return @asset_output_path if defined?(@asset_output_path) && @asset_output_path

@asset_output_path =
File.join(
output_path,
"dist",
SimpleCov::Formatter::TailwindFormatter::VERSION
)
FileUtils.mkdir_p(@asset_output_path)
@asset_output_path
end

def assets_path(name)
File.join(
"./dist",
Expand All @@ -84,6 +67,10 @@ def assets_path(name)
)
end

def inline_public_asset(name)
File.read(File.join(File.dirname(__FILE__), "../public/", name))
end

def generate_dialog(file)
template("dialog").result(binding)
rescue Encoding::CompatibilityError => e
Expand Down
6 changes: 3 additions & 3 deletions views/main.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<title>Code Coverage for <%= SimpleCov.project_name %></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="<%= assets_path('application.css') %>" media="screen, projection, print" rel="stylesheet" type="text/css">
<style type="text/css" media="screen, projection, print"><%= inline_public_asset('application.css') %></style>
</head>
<body class="bg-gray-50 text-slate-500 dark:bg-slate-900 dark:text-slate-400"
data-controller="slideover navigation search" data-slideover-hide-class="hidden" data-slideover-allow-close-value="true"
Expand All @@ -31,7 +31,7 @@
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
</svg>
</div>
<input data-action="input->search#searchEvent" class="block w-full rounded-md border border-slate-900/10 bg-white/95 py-2 pl-10 pr-3 text-sm text-slate-500 placeholder-slate-500 focus:border-blue-700 focus:focus:placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-700 dark:border-slate-50/[0.2] dark:bg-transparent dark:text-slate-400" placeholder="Search File(s)" type="search" autocomplete="on">
<input id="search" data-action="input->search#searchEvent" class="block w-full rounded-md border border-slate-900/10 bg-white/95 py-2 pl-10 pr-3 text-sm text-slate-500 placeholder-slate-500 focus:border-blue-700 focus:focus:placeholder-slate-400 focus:outline-none focus:ring-1 focus:ring-blue-700 dark:border-slate-50/[0.2] dark:bg-transparent dark:text-slate-400" placeholder="Search File(s)" type="search" autocomplete="on">
</div>
</div>
</div>
Expand Down Expand Up @@ -141,6 +141,6 @@
</div>
</div>
</div>
<script src="<%= assets_path('application.js') %>" type="text/javascript"></script>
<script type="text/javascript"><%= inline_public_asset('application.js') %></script>
</body>
</html>