Class: Octopress::Ink::Assets::Sass
Constant Summary
Constants inherited
from Asset
Asset::FRONT_MATTER
Instance Attribute Summary collapse
Attributes inherited from Asset
#base, #dir, #file, #plugin, #replacement, #root
Instance Method Summary
collapse
Methods inherited from Stylesheet
#media, #tag, #tag_path
Methods inherited from Asset
#asset_info, #copy, #data, #disable, #filename, #info, #is_disabled, #path, #payload, #read, #remove_jekyll_asset, #replaced?
Constructor Details
#initialize(plugin, base, file) ⇒ Sass
Returns a new instance of Sass.
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/octopress-ink/assets/sass.rb', line 7
def initialize(plugin, base, file)
@plugin = plugin
@base = base
@file = file
@media = media || 'all'
@root = plugin.assets_path
@dir = File.join(plugin.slug, base)
@exists = {}
file_check
end
|
Instance Attribute Details
#exists ⇒ Object
Returns the value of attribute exists.
5
6
7
|
# File 'lib/octopress-ink/assets/sass.rb', line 5
def exists
@exists
end
|
#render ⇒ Object
Returns the value of attribute render.
5
6
7
|
# File 'lib/octopress-ink/assets/sass.rb', line 5
def render
@render
end
|
Instance Method Details
#add ⇒ Object
18
19
20
21
22
23
|
# File 'lib/octopress-ink/assets/sass.rb', line 18
def add
unless File.basename(file).start_with?('_')
Plugins.add_css_tag tag
Plugins.static_files << StaticFileContent.new(content, destination)
end
end
|
#content ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/octopress-ink/assets/sass.rb', line 39
def content
@render ||= begin
contents = super
if payload
Liquid::Template.parse(contents).render!({ 'plugin' => @plugin.config }.merge(payload))
else
contents
end
end
PluginAssetPipeline.compile_sass(self)
end
|
#destination ⇒ Object
52
53
54
|
# File 'lib/octopress-ink/assets/sass.rb', line 52
def destination
File.join(base, plugin.slug, output_file_name)
end
|
#disabled? ⇒ Boolean
35
36
37
|
# File 'lib/octopress-ink/assets/sass.rb', line 35
def disabled?
is_disabled('sass', filename) || is_disabled('stylesheets', filename)
end
|
#ext ⇒ Object
25
26
27
|
# File 'lib/octopress-ink/assets/sass.rb', line 25
def ext
File.extname(path)
end
|
#load_paths ⇒ Object
29
30
31
32
33
|
# File 'lib/octopress-ink/assets/sass.rb', line 29
def load_paths
lp = [theme_load_path]
lp.unshift user_load_path if Dir.exists? user_load_path
lp
end
|