Class: Octopress::AssetPipeline::Css

Inherits:
Asset
  • Object
show all
Defined in:
lib/octopress-asset-pipeline/assets/css.rb

Direct Known Subclasses

Sass

Instance Attribute Summary

Attributes inherited from Asset

#file_object

Instance Method Summary collapse

Methods inherited from Asset

#base, #copy, #filename, #info, #initialize, #path

Constructor Details

This class inherits a constructor from Octopress::AssetPipeline::Asset

Instance Method Details

#contentObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/octopress-asset-pipeline/assets/css.rb', line 20

def content
  @render ||= begin
    contents = super
    if asset_payload = payload
      Liquid::Template.parse(contents).render!(payload)
    else
      contents
    end
  end
end

#destinationObject



8
9
10
# File 'lib/octopress-asset-pipeline/assets/css.rb', line 8

def destination
  File.join(base, output_file_name)
end

#mediaObject



4
5
6
# File 'lib/octopress-asset-pipeline/assets/css.rb', line 4

def media
  path.to_s.scan(/@(.+?)\./).flatten[0] || 'all'
end

#output_file_nameObject



16
17
18
# File 'lib/octopress-asset-pipeline/assets/css.rb', line 16

def output_file_name
  filename.sub(/@/,'-')
end

#tagObject



12
13
14
# File 'lib/octopress-asset-pipeline/assets/css.rb', line 12

def tag
  "<link href='#{Filters.expand_url(destination)}' media='#{media}' rel='stylesheet' type='text/css'>"
end