Class: Assette::Reader::Css

Inherits:
Object
  • Object
show all
Defined in:
lib/assette/readers/css.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.comment_strObject



28
29
30
# File 'lib/assette/readers/css.rb', line 28

def comment_str
  '/* %s */'
end

.error(str, stack = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/assette/readers/css.rb', line 9

def error str, stack = nil
  <<-CSS
  body:before {
    position: absolute;
    top: 0px;
    padding: 10px;
    font-size: 18px;
    text-align: center;
    width: 100%;
    display: block;
    content: #{str.inspect};
    background-color: #992E40;
    color: white;
    font-weight:bold;
    z-index: 9999;
  }
  CSS
end

.include(path) ⇒ Object



38
39
40
41
42
43
# File 'lib/assette/readers/css.rb', line 38

def include path
  <<-CSS
    #{comment_str % path}
    @import url("#{path}?nodep");
  CSS
end

.tag(path) ⇒ Object



32
33
34
35
36
# File 'lib/assette/readers/css.rb', line 32

def tag path
  <<-HTML
    <link href="#{path}" rel="stylesheet" type="text/css"  media="all" />
  HTML
end

Instance Method Details

#compileObject



3
4
5
# File 'lib/assette/readers/css.rb', line 3

def compile
  @file.text
end