Skip to content

Commit

Permalink
Merge cf89e5a into 0b8f155
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuho Okui committed Jul 4, 2013
2 parents 0b8f155 + cf89e5a commit ce002c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 6 additions & 1 deletion lib/jekyll/assets_plugin/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Configuration
:compress => { :css => nil, :js => nil },
:cachebust => :hard,
:cache_assets => false,
:gzip => %w{ text/css application/javascript }
:gzip => %w{ text/css application/javascript },
:turbolinks => false
}.freeze


Expand Down Expand Up @@ -51,6 +52,10 @@ def cache_assets?
!!@data.cache_assets
end

def turbolinks?
!!@data.turbolinks
end


def gzip
return @data.gzip if @data.gzip.is_a? Array
Expand Down
16 changes: 12 additions & 4 deletions lib/jekyll/assets_plugin/renderer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module Jekyll
module AssetsPlugin
class Renderer

STYLESHEET = '<link rel="stylesheet" type="text/css" href="%s">'
JAVASCRIPT = '<script type="text/javascript" src="%s"></script>'
STYLESHEET = '<link rel="stylesheet" type="text/css" href="%s" data-turbolinks-track>'
JAVASCRIPT = '<script type="text/javascript" src="%s" data-turbolinks-track></script>'


def initialize context, logical_path
Expand All @@ -25,14 +25,22 @@ def render_asset_path
def render_javascript
@path << ".js" if File.extname(@path).empty?

JAVASCRIPT % render_asset_path
ret = JAVASCRIPT % render_asset_path
if !@site.assets_config.turbolinks?
ret = ret.gsub(/data-turbolinks-track/, '')
end
ret
end


def render_stylesheet
@path << ".css" if File.extname(@path).empty?

STYLESHEET % render_asset_path
ret = STYLESHEET % render_asset_path
if !@site.assets_config.turbolinks?
ret = ret.gsub(/data-turbolinks-track/, '')
end
ret
end

end
Expand Down

0 comments on commit ce002c7

Please sign in to comment.