class JsDuck::Web::Css

Writes the CSS gathered from Tag classes and –css option into given file. Then Renames the file so it contains an MD5 hash inside it, returning the resulting fingerprinted name.

Public Class Methods

new(opts) click to toggle source
# File lib/jsduck/web/css.rb, line 13
def initialize(opts)
  @opts = opts
end

Public Instance Methods

write(filename) click to toggle source
# File lib/jsduck/web/css.rb, line 17
def write(filename)
  File.open(filename, 'w') {|f| f.write(all_css) }
  Util::MD5.rename(filename)
end

Private Instance Methods

all_css() click to toggle source
# File lib/jsduck/web/css.rb, line 24
def all_css
  [
    css_from_tags,
    Web::ClassIcons.css,
    Web::MemberIcons.css,
    @opts.css,
  ].join
end
css_from_tags() click to toggle source

Returns all the CSS gathered from @css attributes of tags.

# File lib/jsduck/web/css.rb, line 34
def css_from_tags
  TagRegistry.tags.map(&:css).compact.join("\n")
end