Skip to content

Commit

Permalink
feat(jekyll): use native livereload for better performance
Browse files Browse the repository at this point in the history
  • Loading branch information
sparanoid committed Feb 1, 2018
1 parent e710da3 commit 5a75298
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2,435 deletions.
56 changes: 12 additions & 44 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = (grunt) ->
"bump-only": "grunt-bump"
gitclone: "grunt-git"
replace: "grunt-text-replace"
usebanner: "grunt-banner"

# Track tasks load time
require("time-grunt") grunt
Expand Down Expand Up @@ -65,6 +64,8 @@ module.exports = (grunt) ->
coffee:
files: ["<%= coffeelint.gruntfile.src %>"]
tasks: ["coffeelint:gruntfile"]
options:
reload: true

js:
files: ["<%= config.app %>/**/_js/**/*.js"]
Expand All @@ -81,12 +82,6 @@ module.exports = (grunt) ->
options:
interrupt: true

jekyll:
files: ["<%= config.app %>/**/*", "!_*", "_config*.yml"]
tasks: [
"jekyll:serve"
]

uglify:
options:
report: "gzip"
Expand Down Expand Up @@ -294,21 +289,15 @@ module.exports = (grunt) ->
maximumFileSizeToCacheInBytes: "<%= config.cfg.service_worker.max_size %>"
staticFileGlobs: "<%= config.cfg.service_worker.files %>"

usebanner:
options:
position: "bottom"
banner: "<%= config.banner %>"

dist:
files:
src: ["<%= config.dist %>/**/*.html"]

jekyll:
options:
bundleExec: true

serve:
options:
serve: true
incremental: true
livereload: true
config: "_config.yml,_amsf.yml,<%= config.app %>/_data/<%= amsf.theme.current %>.yml,_config.dev.yml"
dest: "<%= config.dist %><%= config.base_dev %>"
drafts: true
Expand Down Expand Up @@ -377,6 +366,12 @@ module.exports = (grunt) ->
options:
logConcurrentOutput: true

serve:
tasks: [
"jekyll:serve"
"watch"
]

dist:
tasks: [
"htmlmin"
Expand Down Expand Up @@ -546,31 +541,6 @@ module.exports = (grunt) ->
}
]

browserSync:
bsFiles:
src: ["<%= config.dist %>/**"]
options:
watchTask: true
server:
baseDir: "<%= config.dist %>"
port: "<%= config.cfg.port %>"
ghostMode:
clicks: true
scroll: true
location: true
forms: true
logFileChanges: false
snippetOptions:
rule:
match: /<!-- BS_INSERT -->/i
fn: (snippet, match) ->
match + snippet
# Uncomment the following options for client presentation
# tunnel: "<%= config.pkg.name %>"
# online: true
open: true
notify: true

conventionalChangelog:
options:
changelogOpts:
Expand Down Expand Up @@ -664,9 +634,7 @@ module.exports = (grunt) ->
"copy:serve"
"less:serve"
"postcss:serve"
"jekyll:serve"
"browserSync"
"watch"
"concurrent:serve"
]

grunt.registerTask "test", "Build test task", ->
Expand Down
15 changes: 12 additions & 3 deletions _app/_includes/themes/curtana/includes/top.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<!doctype html>

<!--
Apply head only for dev environment, this is required for jekyll to
insert livereload scripts
-->
{% if site.dev == true %}
<head>
{% endif %}

{% if site.force_utf_8 %}
<meta charset="utf-8">
{% endif %}
Expand Down Expand Up @@ -32,10 +40,11 @@
<!-- DNS prefetching for static files -->
{% if page.permalink == "/" %}<link rel="dns-prefetch" href="{{ site.file }}">{% endif %}

<!-- browser-sync, don't remove this -->
<!-- BS_INSERT -->

<!-- Head hooks -->
{% if page.head %}
{{ page.head }}
{% endif %}

{% if site.dev == true %}
</head>
{% endif %}
Loading

0 comments on commit 5a75298

Please sign in to comment.