1
0
mirror of https://github.com/Luzifer/sri.git synced 2024-09-07 18:09:12 +00:00
Helper to calculate SRI information for ` or
Go to file
2019-08-16 23:35:14 +02:00
.repo-runner.yaml Add auto-build 2019-08-16 23:08:23 +02:00
go.mod Initial version 2019-08-16 23:00:10 +02:00
go.sum Initial version 2019-08-16 23:00:10 +02:00
History.md prepare release v0.1.1 2019-08-16 23:35:14 +02:00
LICENSE Add meta files 2019-08-16 23:06:51 +02:00
main.go Fix: Add missing rel attribute to style tags 2019-08-16 23:27:37 +02:00
Makefile Add missing Makefile 2019-08-16 23:11:02 +02:00
README.md Add meta files 2019-08-16 23:06:51 +02:00

Go Report Card

Luzifer / sri

sri is a very small helper to calculate SRI information for <link> or <script> tags.

Files are downloaded as they currently are and a checksum is calculated. This checksum then is printed inside the desired HTML tag for embedding into an HTML page.

Please be aware you should use this with non-changing URLs as the browser will no longer load the file as soon as the hash does no longer match.

Usage

# sri --help
Usage of sri:
      --html               Print HTML tags with SRI information (If disabled just prints the hashes) (default true)
      --html-tag string    Tag to use for HTML mode (supported: link, script) (default "link")
      --log-level string   Log level (debug, info, warn, error, fatal) (default "info")
      --version            Prints current version and exits

# sri --html-tag link https://use.fontawesome.com/releases/v5.10.1/css/all.css
<link href="https://use.fontawesome.com/releases/v5.10.1/css/all.css" integrity="sha512-9my9Mb2+0YO+I4PUCSwUYO7sEK21Y0STBAiFEYoWtd2VzLEZZ4QARDrZ30hdM1GlioHJ8o8cWQiy8IAb1hy/Hg==" crossorigin="anonymous">