Skip to content

Commit

Permalink
feat(grunt): use hashes for assets, help reduce CloudFront invalidati…
Browse files Browse the repository at this point in the history
…on cost
  • Loading branch information
sparanoid committed Aug 30, 2015
1 parent 08eac61 commit d54e8ff
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ module.exports = (grunt) ->
dest: "<%= config.dist %>/"
]

cacheBust:
options:
encoding: "utf8"
algorithm: "md5"
length: 8
deleteOriginals: true

dist:
files: [
expand: true
baseDir: "<%= config.dist %>"
cwd: "<%= config.dist %>"
src: "**/*.html"
dest: "<%= config.dist %>/"
]

usebanner:
options:
position: "bottom"
Expand Down Expand Up @@ -286,6 +302,7 @@ module.exports = (grunt) ->
s3:
command: "s3cmd sync -rP --guess-mime-type --delete-removed --no-preserve --cf-invalidate --add-header=Cache-Control:max-age=31536000 --exclude '.DS_Store' <%= config.cfg.static_files %> <%= config.cfg.s3_bucket %>"

# Copy saved theme to external repository
amsf__theme__to_dev_repo:
command: "rsync -avz --delete --progress --exclude=.git --exclude=node_modules <%= amsf.base %>/themes/<%= amsf.theme.current %>/ /Users/sparanoid/Git/amsf-<%= amsf.theme.current %> > rsync-theme-dev.log"

Expand Down Expand Up @@ -654,6 +671,7 @@ module.exports = (grunt) ->
"jekyll:dist"
"concurrent:dist"
"assets_inline"
"cacheBust"
"usebanner"
"cleanempty"
]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"grunt-banner": "^0.5.0",
"grunt-browser-sync": "^2.1.1",
"grunt-bump": "^0.3.1",
"grunt-cache-bust": "^0.5.1",
"grunt-cleanempty": "^1.0.3",
"grunt-coffeelint": "^0.0.13",
"grunt-concurrent": "^2.0.0",
Expand Down

0 comments on commit d54e8ff

Please sign in to comment.