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
#exclude?, #output_css, #output_file, #output_html, #output_js
Instance Method Details
#copy_file(path, dest_path) ⇒ Object
80
81
82
83
|
# File 'lib/jekyll-press.rb', line 80
def copy_file(path, dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(path, dest_path)
end
|
#write(dest) ⇒ Object
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/jekyll-press.rb', line 85
def write(dest)
dest_path = destination(dest)
return false if File.exist?(dest_path) and !modified?
@@mtimes[path] = mtime
case File.extname(dest_path)
when '.js'
if dest_path =~ /.min.js$/
copy_file(path, dest_path)
else
output_js(dest_path, File.read(path))
end
when '.css'
if dest_path =~ /.min.css$/
copy_file(path, dest_path)
else
output_css(dest_path, File.read(path))
end
else
copy_file(path, dest_path)
end
true
end
|