Skip to content

Commit

Permalink
feat(grunt): move service_worker file globs option to config
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Jan 16, 2017
1 parent fa43158 commit 7c94736
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
6 changes: 1 addition & 5 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,7 @@ module.exports = (grunt) ->
baseDir: "<%= config.dist %>"
workerFile: "service-worker.js"
workerDir: "<%= config.dist %><%= config.base %>"
staticFileGlobs: [
"**/*.{css,html,jpg,gif,png,svg}"
"**/img/**.*"
"**/js/**.js"
]
staticFileGlobs: "<%= config.cfg.service_worker.files %>"

usebanner:
options:
Expand Down
2 changes: 1 addition & 1 deletion _app/_includes/_amsf.html
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@
Service Worker
{% endcomment %}
{% capture amsf_service_worker %}
{% if site.service_worker == true and site.dev == false %}
{% if site.service_worker.enabled == true and site.dev == false %}
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('{{ "/service-worker.js" | prepend: site.base }}').then(function (registration) {
Expand Down
8 changes: 6 additions & 2 deletions _config.init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ primary_color: '#ff00b4'

# Service Worker Precache support
# Service Worker does not work on HTTP
# Default true
service_worker: true
service_worker:
enabled: true
file_globs:
- "**/*.{css,html,jpg,gif,png,svg}"
- "**/img/**.*"
- "**/js/**.js"

# Google Analytics tracking code
google_analytics:
Expand Down
8 changes: 6 additions & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ primary_color: '#ff00b4'

# Service Worker Precache support
# Service Worker does not work on HTTP
# Default true
service_worker: true
service_worker:
enabled: true
files:
- "**/*.{css,html,jpg,gif,png,svg}"
- "**/img/**.*"
- "**/js/**.js"

# Google Analytics tracking code
google_analytics:
Expand Down

0 comments on commit 7c94736

Please sign in to comment.