Class: Jekyll::StaticFile
- Inherits:
-
Object
- Object
- Jekyll::StaticFile
show all
- Includes:
- Compressor
- Defined in:
- lib/jekyll-minifier.rb
Instance Method Summary
collapse
Methods included from Compressor
#output_compressed, #output_css, #output_file, #output_html, #output_js, #output_json
Instance Method Details
#copy_file(path, dest_path) ⇒ Object
191
192
193
194
|
# File 'lib/jekyll-minifier.rb', line 191
def copy_file(path, dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(path, dest_path)
end
|
#write(dest) ⇒ Object
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
# File 'lib/jekyll-minifier.rb', line 196
def write(dest)
dest_path = destination(dest)
return false if File.exist?(dest_path) and !modified?
self.class.mtimes[path] = mtime
if exclude?(dest, dest_path)
copy_file(path, dest_path)
else
case File.extname(dest_path)
when '.js'
if dest_path.end_with?('.min.js')
copy_file(path, dest_path)
else
output_js(dest_path, File.read(path))
end
when '.json'
output_json(dest_path, File.read(path))
when '.css'
if dest_path.end_with?('.min.css')
copy_file(path, dest_path)
else
output_css(dest_path, File.read(path))
end
when '.xml'
output_html(dest_path, File.read(path))
else
copy_file(path, dest_path)
end
end
true
end
|