lib/octopress-ink/plugins.rb in octopress-ink-1.0.0.alpha.13 vs lib/octopress-ink/plugins.rb in octopress-ink-1.0.0.alpha.14
- old
+ new
@@ -98,11 +98,12 @@
write_files(site, contents, combined_stylesheet_path(media))
end
end
def self.write_combined_javascript(site)
- write_files(site, combine_javascripts(site), combined_javascript_path)
+ js = combine_javascripts(site)
+ write_files(site, js, combined_javascript_path) unless js == ''
end
def self.combine_stylesheets(site)
unless @combined_stylesheets
css = {}
@@ -134,30 +135,35 @@
end
@combined_stylesheets
end
def self.combine_javascripts(site)
- js = ''
- plugins.each do |plugin|
- paths = plugin.javascript_paths(site)
- @javascript_fingerprint = fingerprint(paths)
- paths.each do |file|
- js.concat Pathname.new(file).read
+ unless @combined_javascripts
+ js = ''
+ plugins.each do |plugin|
+ paths = plugin.javascript_paths(site)
+ @javascript_fingerprint = fingerprint(paths)
+ paths.each do |file|
+ js.concat Pathname.new(file).read
+ end
end
+ @combined_javascripts = js
end
- js
+ @combined_javascripts
end
def self.combined_stylesheet_tag(site)
tags = ''
combine_stylesheets(site).keys.each do |media|
tags.concat "<link href='/#{combined_stylesheet_path(media)}' media='#{media}' rel='stylesheet' type='text/css'>"
end
tags
end
- def self.combined_javascript_tag
- "<script src='/#{combined_javascript_path}'></script>"
+ def self.combined_javascript_tag(site)
+ unless combine_javascripts(site) == ''
+ "<script src='/#{combined_javascript_path}'></script>"
+ end
end
def self.stylesheet_tags
css = []
plugins.each do |plugin|