1
- class debugInfo {
2
- constructor ( context , ctx , lineSeparator ) {
3
- let result = '' ;
4
- if ( context . dumpLineNumbers && ! context . compress ) {
5
- switch ( context . dumpLineNumbers ) {
6
- case 'comments' :
7
- result = debugInfo . asComment ( ctx ) ;
8
- break ;
9
- case 'mediaquery' :
10
- result = debugInfo . asMediaQuery ( ctx ) ;
11
- break ;
12
- case 'all' :
13
- result = debugInfo . asComment ( ctx ) + ( lineSeparator || '' ) + debugInfo . asMediaQuery ( ctx ) ;
14
- break ;
15
- }
16
- }
17
- return result ;
18
- }
1
+ function asComment ( ctx ) {
2
+ return `/* line ${ ctx . debugInfo . lineNumber } , ${ ctx . debugInfo . fileName } */\n` ;
3
+ }
19
4
20
- static asComment ( ctx ) {
21
- return `/* line ${ ctx . debugInfo . lineNumber } , ${ ctx . debugInfo . fileName } */\n` ;
5
+ function asMediaQuery ( ctx ) {
6
+ let filenameWithProtocol = ctx . debugInfo . fileName ;
7
+ if ( ! / ^ [ a - z ] + : \/ \/ / i. test ( filenameWithProtocol ) ) {
8
+ filenameWithProtocol = `file://${ filenameWithProtocol } ` ;
22
9
}
10
+ return `@media -sass-debug-info{filename{font-family:${ filenameWithProtocol . replace ( / ( [ . : \/ \\ ] ) / g, function ( a ) {
11
+ if ( a == '\\' ) {
12
+ a = '\/' ;
13
+ }
14
+ return `\\${ a } ` ;
15
+ } ) } }line{font-family:\\00003${ ctx . debugInfo . lineNumber } }}\n`;
16
+ }
23
17
24
- static asMediaQuery ( ctx ) {
25
- let filenameWithProtocol = ctx . debugInfo . fileName ;
26
- if ( ! / ^ [ a - z ] + : \/ \/ / i. test ( filenameWithProtocol ) ) {
27
- filenameWithProtocol = `file://${ filenameWithProtocol } ` ;
18
+ function debugInfo ( context , ctx , lineSeparator ) {
19
+ let result = '' ;
20
+ if ( context . dumpLineNumbers && ! context . compress ) {
21
+ switch ( context . dumpLineNumbers ) {
22
+ case 'comments' :
23
+ result = asComment ( ctx ) ;
24
+ break ;
25
+ case 'mediaquery' :
26
+ result = asMediaQuery ( ctx ) ;
27
+ break ;
28
+ case 'all' :
29
+ result = asComment ( ctx ) + ( lineSeparator || '' ) + asMediaQuery ( ctx ) ;
30
+ break ;
28
31
}
29
- return `@media -sass-debug-info{filename{font-family:${ filenameWithProtocol . replace ( / ( [ . : \/ \\ ] ) / g, function ( a ) {
30
- if ( a == '\\' ) {
31
- a = '\/' ;
32
- }
33
- return `\\${ a } ` ;
34
- } ) } }line{font-family:\\00003${ ctx . debugInfo . lineNumber } }}\n`;
35
32
}
33
+ return result ;
36
34
}
37
35
38
- export default debugInfo ;
36
+ export default debugInfo ;
0 commit comments