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
From the course: Learning Static Site Building with Hugo
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Deploy via FTP overview2m 2s
-
(Locked)
Set up Node and npm1m 40s
-
(Locked)
Connect to the server7m 21s
-
(Locked)
Collect the local files4m 51s
-
(Locked)
Remove old files from the server5m 39s
-
(Locked)
Upload the site content2m 43s
-
(Locked)
Deploy via FTP with Travis CI1m 57s
-
(Locked)
FTP next steps1m 2s
-
-
-
-