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

add jekyll-pwa-plugin #6533

Merged
merged 3 commits into from Nov 9, 2017
Merged

add jekyll-pwa-plugin #6533

merged 3 commits into from Nov 9, 2017

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented Nov 8, 2017

No description provided.

@@ -960,6 +960,7 @@ You can find a few useful plugins at the following locations:
- [Jekyll-Post](https://github.com/robcrocombe/jekyll-post): A CLI tool to easily draft, edit, and publish Jekyll posts.
- [jekyll-numbered-headings](https://github.com/muratayusuke/jekyll-numbered-headings): Adds ordered number to headings.
- [jekyll-pre-commit](https://github.com/mpchadwick/jekyll-pre-commit): A framework for running checks against your posts using a git pre-commit hook before you publish them.
- [jekyll-pwa-plugin](https://github.com/lavas-project/jekyll-pwa): A plugin provides PWA support for Jekyll. Generate a service worker and provides precache and runtime cache with Google Workbox.
Copy link
Member

Choose a reason for hiding this comment

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

Can you change Generate to Generates please?

I'm still learning about PWAs but I wasn't aware that there was a dependency there on Google Workbox. Is that just an implementation detail of your plugin?

Copy link
Member

Choose a reason for hiding this comment

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

@mattr- It's an implementation by Google to make it easier to get started.

Copy link
Contributor Author

@xiaoiver xiaoiver Nov 9, 2017

Choose a reason for hiding this comment

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

Thanks guys. As DirtyF says, Google Workbox has already developed a series of tools . If you use Webpack or Gulp as your build tool, you can easily generate a service worker with these tools. But in my blog, I don't want to use even npm, and I want to precache recent 10 posts so that they are offline available to visitors even though these posts were never opened by visitors before. That's why I try to integrate this function in Jekyll build process.

In the service worker generated by this plugin, I still use Workbox API such as precache and runtime cache routes inside. But through the relative configuration in _config.yml, I think it will help a lot for those who are not familiar with Workbox.

@DirtyF DirtyF added the site label Nov 8, 2017
Copy link
Member

@DirtyF DirtyF left a comment

Choose a reason for hiding this comment

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

Cool plugin, will check it out. 🚀

@ashmaroli
Copy link
Member

ashmaroli commented Nov 9, 2017

@xiaoiver You might want to update the plugin's usage section. When i initially tried adding the gem and config block to my test site, bundle exec jekyll serve failed with an error..
(resumed properly after I manually copied the contents of your vendor/ to my site)

Note: This should ideally be a bug report in your repo, but the plugin is only at 0.0.1 .. bound to have issues..

@xiaoiver
Copy link
Contributor Author

xiaoiver commented Nov 9, 2017

Hi @ashmaroli , in this plugin I want to copy two files(a polyfill & workbox) under /vendor to _site/js:

Dir.glob(File.expand_path('../vendor/**/*', __FILE__)) do |filepath_to_copy|
    basename = File.basename(filepath_to_copy)
    FileUtils.copy_file(filepath_to_copy, File.join(@site.dest, 'js', basename))

So in service worker generated, I can import these scripts correctly:
importScripts('#{@site.baseurl}/js/#{vendor_file}');

Maybe I make a wrong assumption that users put their scripts in /js.
Since I'm not very familiar with Ruby and Jekyll indeed, plz point it out if I make some mistakes.

@ashmaroli
Copy link
Member

@xiaoiver opened an issue ticket at your repo.. best, we continue there..

@DirtyF
Copy link
Member

DirtyF commented Nov 9, 2017

@jekyllbot: merge +site

@jekyllbot jekyllbot merged commit 0c25411 into jekyll:master Nov 9, 2017
jekyllbot added a commit that referenced this pull request Nov 9, 2017
@jekyll jekyll locked and limited conversation to collaborators Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants