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
Instance Method Details
#copy_file(path, dest_path) ⇒ Object
169
170
171
172
|
# File 'lib/jekyll-minifier.rb', line 169
def copy_file(path, dest_path)
FileUtils.mkdir_p(File.dirname(dest_path))
FileUtils.cp(path, dest_path)
end
|
#write(dest) ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
# File 'lib/jekyll-minifier.rb', line 174
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 '.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
|