Class: Octopress::Ink::Assets::Coffeescript

Inherits:
Javascript show all
Defined in:
lib/octopress-ink/assets/coffeescript.rb

Constant Summary

Constants inherited from Asset

Asset::FRONT_MATTER

Instance Attribute Summary

Attributes inherited from Asset

#base, #dir, #exists, #file, #plugin, #replacement, #root

Instance Method Summary collapse

Methods inherited from Javascript

#tag

Methods inherited from Asset

#asset_info, #copy, #data, #disable, #disabled?, #ext, #filename, #info, #initialize, #is_disabled, #path, #payload, #read, #remove_jekyll_asset, #replaced?

Constructor Details

This class inherits a constructor from Octopress::Ink::Assets::Asset

Instance Method Details

#addObject



10
11
12
13
# File 'lib/octopress-ink/assets/coffeescript.rb', line 10

def add
  Plugins.add_js_tag tag
  Plugins.static_files << StaticFileContent.new(content, destination)
end

#contentObject



15
16
17
18
19
20
21
22
# File 'lib/octopress-ink/assets/coffeescript.rb', line 15

def content
  begin
    require 'jekyll-coffeescript'
  rescue LoadError
    raise "Add gem jekyll-coffeescript to Gemfile (or gemspec)."
  end
  ::CoffeeScript.compile(super)
end

#destinationObject



24
25
26
# File 'lib/octopress-ink/assets/coffeescript.rb', line 24

def destination
  File.join(base, plugin.slug, File.basename(file, '.*') << '.js')
end

#tag_pathObject



6
7
8
# File 'lib/octopress-ink/assets/coffeescript.rb', line 6

def tag_path
  Filters.expand_url(File.join(dir, File.basename(file, '.*') << '.js'))
end