jekyll-asset-pipeline 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -232,19 +232,19 @@ In the following example, we will override the default CSS link tag by adding a
232
232
 
233
233
  1. In the "jekyll\_asset\_pipeline.rb" file that we created in the "Getting Started" section, add the following code.
234
234
 
235
- ``` ruby
236
- module JekyllAssetPipeline
237
- class CssTagTemplate < JekyllAssetPipeline::Template
238
- def self.filetype
239
- '.css'
240
- end
235
+ ``` ruby
236
+ module JekyllAssetPipeline
237
+ class CssTagTemplate < JekyllAssetPipeline::Template
238
+ def self.filetype
239
+ '.css'
240
+ end
241
241
 
242
- def html
243
- "<link href='/#{@path}/#{@filename}' rel='stylesheet' type='text/css' media='screen' />\n"
242
+ def html
243
+ "<link href='/#{@path}/#{@filename}' rel='stylesheet' type='text/css' media='screen' />\n"
244
+ end
244
245
  end
245
246
  end
246
- end
247
- ```
247
+ ```
248
248
 
249
249
  > *If you already added a compressor and/or a converter, you can include your template class alongside your compressor and/or converter within the same JekyllAssetPipeline module.*
250
250
 
@@ -263,6 +263,7 @@ asset_pipeline:
263
263
  bundle: true # Default = true
264
264
  compress: true # Default = true
265
265
  output_path: assets # Default = assets
266
+ display_path: nil # Default = nil
266
267
  gzip: false # Default = false
267
268
  ```
268
269
 
@@ -271,6 +272,7 @@ asset_pipeline:
271
272
  > - 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.
272
273
  > - 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.
273
274
  > - The "output\_path" setting defines where generated bundles should be saved within the "\_site" folder of your project.
275
+ > - 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/").
274
276
  > - The "gzip" setting controls whether Jekyll Asset Pipeline saves gzipped versions of your assets alongside un-gzipped versions.
275
277
 
276
278
  ## Octopress
@@ -39,6 +39,7 @@ module JekyllAssetPipeline
39
39
  # Strings used for keys to play nice when merging with _config.yml
40
40
  DEFAULTS = {
41
41
  'output_path' => 'assets', # Destination for bundle file (within the '_site' directory)
42
+ 'display_path' => nil, # Optional. Override path to assets for output HTML refs
42
43
  'bundle' => true, # true = Bundle assets, false = Leave assets unbundled
43
44
  'compress' => true, # true = Minify assets, false = Leave assets unminified
44
45
  'gzip' => false # true = Create gzip versions, false = Do not create gzip versions
@@ -202,14 +202,15 @@ module JekyllAssetPipeline
202
202
 
203
203
  # Generate html markup pointing to assets
204
204
  def markup
205
- path = @options['output_path']
205
+ # Use display_path if defined, otherwise use output_path in url
206
+ display_path = @options['display_path'] || @options['output_path']
206
207
 
207
208
  @html = @assets.map do |asset|
208
209
  klass = JekyllAssetPipeline::Template.subclasses.select do |t|
209
210
  t.filetype == File.extname(asset.filename).downcase
210
211
  end.sort! { |x, y| x.priority <=> y.priority }.last
211
212
 
212
- html = klass.new(path, asset.filename).html unless klass.nil?
213
+ html = klass.new(display_path, asset.filename).html unless klass.nil?
213
214
 
214
215
  html
215
216
  end.join
@@ -20,8 +20,8 @@ module JekyllAssetPipeline
20
20
  # HTML output to return
21
21
  #
22
22
  # Available instance variables:
23
- # @path Path to bundle file
24
- # @filename Name of bundle file
23
+ # @filename Name of bundle file
24
+ # @path Path to bundle file
25
25
  #
26
26
  # Returns string
27
27
  def html
@@ -1,3 +1,3 @@
1
1
  module JekyllAssetPipeline
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-asset-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: