Class: Jekyll::StaticFile
- Inherits:
-
Object
- Object
- Jekyll::StaticFile
show all
- Includes:
- Compressor
- Defined in:
- lib/jekyll-press.rb
Instance Method Summary
collapse
Methods included from Compressor
#output_css, #output_file, #output_html, #output_js
Instance Method Details
#copy_file(path, dest_path) ⇒ Object
60
61
62
63
|
# File 'lib/jekyll-press.rb', line 60
def copy_file(path, dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(path, dest_path)
end
|
#write(dest) ⇒ Object
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/jekyll-press.rb', line 65
def write(dest)
dest_path = self.destination(dest)
return false if File.exist?(dest_path) and !self.modified?
@@mtimes[path] = mtime
case File.extname(dest_path)
when '.js'
if dest_path =~ /.min.js$/
copy_file(path, dest_path)
else
self.output_js(dest_path, File.read(path))
end
when '.css'
if dest_path =~ /.min.css$/
copy_file(path, dest_path)
else
self.output_css(dest_path, File.read(path))
end
else
copy_file(path, dest_path)
end
true
end
|