Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds fingerprint option #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ Jekyll Asset Pipeline provides the following configuration options that can be c
``` yaml
asset_pipeline:
bundle: true # Default = true
fingerprint: true # Default = true
compress: true # Default = true
output_path: assets # Default = assets
display_path: nil # Default = nil
Expand All @@ -270,6 +271,7 @@ asset_pipeline:
> *If you don't have a "\_config.yml" file, consider reading the [configuration section](https://github.com/mojombo/jekyll/wiki/Configuration) of the Jekyll documentation.*
>
> - The "bundle" setting controls whether Jekyll Asset Pipeline bundles the assets defined in each manifest. If "bundle" is set to false, each asset will be saved individually and individual html tags pointing to each unbundled asset will be produced when you compile your site. It is useful to set this to false while you are debugging your site.
> - The "fingerprint" setting is for when bundle is set to true and you want to disable the fingerprint postfix from being applied to filenames.
> - The "compress" setting tells Jekyll Asset Pipeline whether or not to compress the bundled assets. It is useful to set this setting to "false" while you are debugging your site.
> - The "output\_path" setting defines where generated bundles should be saved within the "\_site" folder of your project.
> - The "display\_path" setting overrides the path to assets in generated html tags. This is useful if you are hosting your site at a path other than the root of your domain (e.g. "http://example.com/blog/").
Expand Down
1 change: 1 addition & 0 deletions lib/jekyll_asset_pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module JekyllAssetPipeline
'display_path' => nil,
'staging_path' => '.asset_pipeline',
'bundle' => true,
'fingerprint' => true,
'compress' => true,
'gzip' => false
}
Expand Down
8 changes: 6 additions & 2 deletions lib/jekyll_asset_pipeline/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,12 @@ def bundle
a.content
end.join("\n")

hash = JekyllAssetPipeline::Pipeline.hash(@source, @manifest, @options)
@assets = [JekyllAssetPipeline::Asset.new(content, "#{@prefix}-#{hash}#{@type}")]
if @options['fingerprint'] == false
@assets = [JekyllAssetPipeline::Asset.new(content, "#{@prefix}#{@type}")]
else
hash = JekyllAssetPipeline::Pipeline.hash(@source, @manifest, @options)
@assets = [JekyllAssetPipeline::Asset.new(content, "#{@prefix}-#{hash}#{@type}")]
end
end

# Compress assets if compressor is defined
Expand Down