VSCode task to upload Hugo to S3

1 min. read


If you want a bit more automated way how to upload public/ folder to AWS s3, check this tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "S3 deploy",
      "type": "shell",
      "command": "hugo --minify && aws s3 sync public/ ${input:s3bucket} --delete --exclude \"*css\" --exclude \"*.js\" --exclude \"*.png\" --exclude \"*.jpg\" --exclude \"*.woff\" && echo '--- s3 upload with cache-control: ---' && aws s3 cp public/ ${input:s3bucket} --recursive --exclude \"*\"  --include \"*css\" --include \"*.js\" --include \"*.png\" --include \"*.jpg\" --include \"*.webp\" --include \"*.woff\" --cache-control \"max-age=31536000\"",
      "group": "build",
      "problemMatcher": []
    },
  ],
  "inputs": [
    {
      "id" : "s3bucket",
      "type" : "promptString",
      "description" : "S3 bucket variable",
      "default": "<enter-name-of-your-s3-bucket>",
    }
  ]
}

You can add some feedback to this gist at Github

2. May 2020
Posted in Gists
Tomas
Tomas

Software developer, lives in Zilina, Slovakia. Fan of modern web technologies, digitalization, cloud and education. Also co-owner of a local coffee brand - Kava Doppio