Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Add inline assets option #107

Merged
merged 4 commits into from
Oct 29, 2023

Conversation

frankh
Copy link
Contributor

@frankh frankh commented Oct 19, 2020

This allows simplecov to generate a single index.html file and not have to generate an assets folder if the env var SIMPLECOV_INLINE_ASSETS is defined

Resolves #33

Based on the implementation by @eins78 eins78@939548d

views/layout.erb Outdated
@@ -6,7 +6,6 @@
<script src='<%= assets_path('application.js') %>' type='text/javascript'></script>
<link href='<%= assets_path('application.css') %>' media='screen, projection, print' rel='stylesheet' type='text/css' />
<link rel="shortcut icon" type="image/png" href="<%= assets_path("favicon_#{coverage_css_class(result.source_files.covered_percent)}.png") %>" />
<link rel="icon" type="image/png" href="<%= assets_path('favicon.png') %>" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

favicon.png doesn't exist so this never did anything anyway

@@ -18,11 +18,15 @@ module Formatter
class HTMLFormatter
def initialize
@branchable_result = SimpleCov.branch_coverage?
@inline_assets = !ENV["SIMPLECOV_INLINE_ASSETS"].nil?
@public_assets_dir = File.join(File.dirname(__FILE__), "../public/")
Copy link
Contributor Author

@frankh frankh Oct 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved @public_assets_dir here to fix ABC rubocop complaints

".css" => "text/css",
}[File.extname(name)]

base64_content = Base64.strict_encode64 File.open(path).read
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a require "base64" on top of the file? I got a NameError when I tried to run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, sorry i missed this comment

better 3 years late than never I guess?

@adi-pen adi-pen mentioned this pull request Feb 10, 2021
@adi-pen
Copy link

adi-pen commented Feb 16, 2021

@frankh Thanks for your work on this. This feature helps me as well.
Tagging you in case you missed the above PR comment.

@ryansdwilson
Copy link

Would love to see this merged! Can't view the html reports on buildkite unless they're inlined.

@AMHOL AMHOL mentioned this pull request Sep 22, 2021
@ohookins
Copy link

Any chance of seeing this merged? We have the same issue with Buildkite.

@iuri-gg
Copy link

iuri-gg commented Jan 30, 2023

Is there a reason this is not getting merged in? Would love to see this feature too - same issue with CI as above

frankh and others added 3 commits September 30, 2023 21:21
This allows simplecov to generate a single `index.html` file and not
have to generate an assets folder
@frankh frankh force-pushed the frankh/inline-assets branch from 2ade4e7 to 4648225 Compare September 30, 2023 20:23
@frankh frankh requested a review from onlined September 30, 2023 20:25
@frankh
Copy link
Contributor Author

frankh commented Sep 30, 2023

@amatsuda or @PragTob if you could take a look and hit merge that would be great 🙏 I just found this 3 year old PR I made and it's still relevant

@amatsuda
Copy link
Member

Merging this, finally. Thank you @eins78 and @frankh!

@amatsuda amatsuda merged commit 79ddf61 into simplecov-ruby:main Oct 29, 2023
8 checks passed
kokuyouwind added a commit to kokuyouwind/rbs_goose that referenced this pull request Feb 20, 2024
@see simplecov-ruby/simplecov-html#107
まだリリースされていないため、コミットハッシュ指定で依存解決するようにした
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature proposal: Inline assets
7 participants