-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
88 changed files
with
9,427 additions
and
248 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
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ ruby '2.2.3' | |
|
||
gem 'hitimes' | ||
gem 'jekyll' | ||
|
||
|
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
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
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,54 @@ | ||
# https://gist.github.com/andyfowler/642739 | ||
|
||
module Jekyll | ||
|
||
class LessCssFile < StaticFile | ||
def write(dest) | ||
# do nothing | ||
end | ||
end | ||
|
||
# Expects a lessc: key in your _config.yml file with the path to a local less.js/bin/lessc | ||
# Less.js will require node.js to be installed | ||
class LessJsGenerator < Generator | ||
safe true | ||
priority :low | ||
|
||
def generate(site) | ||
src_root = site.config['source'] | ||
dest_root = site.config['destination'] | ||
less_ext = /\.less$/i | ||
|
||
raise "Missing 'lessc' path in site configuration" if !site.config['lessc'] | ||
|
||
# static_files have already been filtered against excludes, etc. | ||
site.static_files.each do |sf| | ||
next if not sf.path =~ less_ext | ||
|
||
less_path = sf.path | ||
css_path = less_path.gsub(less_ext, '.css').gsub(src_root, dest_root) | ||
css_dir = File.dirname(css_path) | ||
css_dir_relative = css_dir.gsub(dest_root, '') | ||
css_name = File.basename(css_path) | ||
|
||
FileUtils.mkdir_p(css_dir) | ||
|
||
begin | ||
command = [site.config['lessc'], | ||
less_path, | ||
css_path | ||
].join(' ') | ||
|
||
puts 'Compiling LESS: ' + command | ||
|
||
`#{command}` | ||
|
||
raise "LESS compilation error" if $?.to_i != 0 | ||
end | ||
|
||
# Add this output file so it won't be cleaned | ||
site.static_files << LessCssFile.new(site, site.source, css_dir_relative, css_name) | ||
end | ||
end | ||
end | ||
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
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
Oops, something went wrong.