-
Notifications
You must be signed in to change notification settings - Fork 38
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
Implement #181 - web app manifest support #182
base: master
Are you sure you want to change the base?
Conversation
I should also mention my sources for how to work with a manifest. The spec is here: https://w3c.github.io/manifest/, and this was useful for seeing how it's actually supported in browsers: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json. I paid the most attention to the output from http://realfavicongenerator.net/, which does a nice job of exposing the most relevant parts of a manifest. It seems to focus primarily on Android, preferring a different approach for other operating systems, hence the docstring for |
src/io/perun.clj
Outdated
:pod pod})))) | ||
|
||
(deftask manifest | ||
"Creates a manifest.json for Android (currently)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's only for android? Wouldn't it work also on the desktop? What makes it Android specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely don't understand everything about this, so I may be completely wrong. But for what it's worth - I took my cue from the Real Favicon Generator (http://realfavicongenerator.net/), which only references icons specifically for Android in manifest.json. I also can't find any examples of how manifest.json is supported on the desktop, and according to https://developer.mozilla.org/en-US/docs/Web/Manifest, no desktop browsers support it.
new-meta (write-file options tgt-path file resized-buffered-image resolution) | ||
dimensions {:width (first new-dimensions) :height (second new-dimensions)}] | ||
(merge file new-meta dimensions (select-keys options [:out-dir])))) | ||
(def img-cache (atom {})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, that is nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad you like it :)
83507ec
to
ff736bb
Compare
This feature will allow sites built with Perun to be installed as an app on systems that support it. When paired with #180, this will be a slick offline experience.
The Lighthouse Chrome extension made some recommendations for attributes to include, so I've updated Perun's manifest.json handling
@podviaznikov I've made a few improvements, and I believe I've addressed your comment on the docstring (you were right). Let me know if you'd like to see other changes. |
This is a great feature! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
If you will have time, please update one of our example projects to use it. If you don't have time, merge away and create a ticket in the repo (to update example project with this task). Maybe someone else would be able to contribute it
Hi, @bhagany Thanks again for your hard work! |
This feature will allow sites built with Perun to be installed as an app on systems that support it. When paired with #180, this will be a slick offline experience.
This was a bit more work to implement properly than I thought at first, primarily because I wanted to support automatically handling image files for the icons that are referenced in manifest.json. This required a refactor for
images-resize
, which is backwards-compatible. This in turn caused another small backwards-compatible addition tocontent-task
to allow a boot tmp directory to be passed. This was necessary to accommodate tasks that want to write directly to tmp directories from within their pod, rather than passing data back to the main pod, as is the case for the image-handling tasks.Other changes here are small improvements like pruning unused requires, and consistently handling the
out-dir
parameter to tasks. These should be self-explanatory, but if you have questions let me know.I've also added tests for
manifest
.