forked from slashdotdash/jekyll-lunr-js-search
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Bower config file with references to 3rd party JavaScript libs. Add rake build task for minifying JavaScript into single `search.min.js`. Include minified `search.min.js` in build directory.
- Loading branch information
Ben Smith
committed
Mar 22, 2014
1 parent
5bfd781
commit 9e11183
Showing
7 changed files
with
171 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
bower_components | ||
*.gem | ||
*.rbc | ||
.bundle | ||
|
@@ -15,4 +16,4 @@ tmp | |
# YARD artifacts | ||
.yardoc | ||
_yardoc | ||
doc/ | ||
doc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rake' | ||
gem 'uglifier' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
execjs (1.4.0) | ||
multi_json (~> 1.0) | ||
json (1.8.0) | ||
multi_json (1.7.0) | ||
rake (10.1.1) | ||
uglifier (2.4.0) | ||
execjs (>= 0.3.0) | ||
json (>= 1.8.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
rake | ||
uglifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,40 @@ | ||
task :build do | ||
system('mkdir -p build; ls *.rb | while read file; do cat $file; echo ""; done > build/jekyll_lunr_js_search.rb') | ||
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 *.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "jekyll-lunr-js-search", | ||
"version": "0.0.1", | ||
"homepage": "https://github.com/slashdotdash/jekyll-lunr-js-search", | ||
"authors": [ | ||
"Ben Smith <[email protected]>" | ||
], | ||
"description": "Jekyll + lunr.js = Static websites with powerful full-text search using JavaScript.", | ||
"keywords": [ | ||
"jekyll", | ||
"lunr", | ||
"search" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"build" | ||
], | ||
"dependencies": { | ||
"jquery": "~2.1.0", | ||
"lunr.js": "~0.4.5", | ||
"mustache": "~0.8.1", | ||
"date.format": "http://stevenlevithan.com/assets/misc/date.format.js", | ||
"uri.js": "~1.12.0" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters