Class: Octopress::AssetPipeline::Plugin

Inherits:
Ink::Plugin
  • Object
show all
Defined in:
lib/octopress-asset-pipeline.rb

Instance Method Summary collapse

Instance Method Details

#add_filesObject



29
30
31
32
33
34
35
36
37
38
# File 'lib/octopress-asset-pipeline.rb', line 29

def add_files
  if Octopress.site.pages.empty? && Octopress.site.posts.empty?
    Octopress.site.read_directories 
  end

  add_static_files
  add_page_files
  add_stylesheets
  add_javascripts
end

#config(*args) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/octopress-asset-pipeline.rb', line 40

def config(*args)
  @config ||= begin
    c = Ink.configuration['asset_pipeline']

    # Deprecation warning - remove in 2.1
    if c['javascripts_dir']
      warn('Deprecation Warning:'.yellow + ' Asset_pipeline configuration key `javascripts_dir` has been renamed to `javascripts_source`. Please update your configuration.')
      c['javascripts_source'] = c.delete('javascripts_dir')
    end
    
    if c['stylesheets_dir']
      warn('Deprecation Warning:'.yellow + ' Asset_pipeline configuration key `stylesheets_dir` has been renamed to `stylesheets_source`. Please update your configuration.')
      c['stylesheets_source'] = c.delete('stylesheets_dir')
    end

    {
      'stylesheets_source' => ['stylesheets', 'css'],
      'javascripts_source' => ['javascripts', 'js']
    }.merge(c).merge({ 'disable' => {} })
  end
end

#registerObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/octopress-asset-pipeline.rb', line 15

def register
  reset
  # Tell Jekyll to read static files and pages
  # This is necessary when Jekyll isn't being asked to build a site,
  # like when a user runs the list command to list assets
  #
  if Octopress::Docs.enabled?
    add_docs
  end
  if Octopress::Ink.enabled?
    add_files
  end
end