Method: Jekyll::StaticFile#write

Defined in:
lib/jekyll/static_file.rb

#write(dest) ⇒ Object

Write the static file to the destination directory (if modified).

dest - The String path to the destination dir.

Returns false if the file was not modified since last time (no-op).



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/jekyll/static_file.rb', line 75

def write(dest)
  dest_path = destination(dest)

  return false if File.exist?(dest_path) && !modified?
  @@mtimes[path] = mtime

  FileUtils.mkdir_p(File.dirname(dest_path))
  FileUtils.rm(dest_path) if File.exist?(dest_path)
  FileUtils.cp(path, dest_path)
  File.utime(@@mtimes[path], @@mtimes[path], dest_path)

  true
end