From the course: Learning Static Site Building with Hugo

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Collect the local files

Collect the local files

From the course: Learning Static Site Building with Hugo

Start my 1-month free trial

Collect the local files

- [Instructor] After connecting to the server, the first thing the deploy script needs to do is collect a list of all the generated site files and directories that need to be uploaded to the server. We'll do that in the scan local files function. Instead of returning an empty array, now we can start flushing this out. Let's say ... We'll say the local public directory equals upath.join. Joining the path process.CWD, which is current working directory. Basically where we are right now plus the public folder. Which is where we know the site files will be generated to. Then we need to return a glob. We'll use the backticks instead of quotes here to do string interpolation in node which means we can do this, (localPublicDir)/**/* Which is a syntax that means give me everything, every file and folder recursively underneath the public folder. Then after that comes back we'll get a bunch of matches. We'll call those globMatches. And open up some code a code block to deal with that. We'll say…

Contents