-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
41 lines (32 loc) · 1003 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require 'rake'
require 'uglifier'
task :default => :build
task :build => [:create_build_dir, :copy_jekyll_plugin, :concat_js, :minify_js] do
end
task :create_build_dir do
Dir.mkdir('build') unless Dir.exists?('build')
end
task :copy_jekyll_plugin do
system('ls lib/jekyll_lunr_js_search/*.rb | while read file; do cat $file; echo ""; done > build/jekyll_lunr_js_search.rb')
end
task :concat_js do
out = ''
files = [
'bower_components/jquery/dist/jquery.js',
'bower_components/lunr.js/lunr.js',
'bower_components/mustache/mustache.js',
'bower_components/date.format/index.js',
'bower_components/uri.js/src/URI.js',
'js/jquery.lunr.search.js'
]
files.each do |file|
out += File.read(file)
end
File.open('build/search.min.js', 'w') do |file|
file.write(out)
end
end
task :minify_js do
minified = Uglifier.compile(File.read('build/search.min.js'))
File.open('build/search.min.js', 'w') { |file| file.write(minified) }
end