1
- using System ;
2
- using System . Collections . Generic ;
1
+ using System . Collections . Generic ;
3
2
using System . IO ;
4
- using System . Linq ;
5
- using System . Text ;
6
- using System . Threading . Tasks ;
7
3
8
4
namespace WebCompiler
9
5
{
10
6
class SassDependencyResolver : DependencyResolverBase
11
7
{
12
-
13
8
public override string [ ] SearchPatterns
14
9
{
15
- get
16
- {
17
- return new string [ ] { "*.scss" , "*.sass" } ;
18
- }
10
+ get { return new [ ] { "*.scss" , "*.sass" } ; }
19
11
}
20
12
21
13
/// <summary>
@@ -28,18 +20,18 @@ public override void UpdateFileDependencies(string path)
28
20
{
29
21
path = path . ToLowerInvariant ( ) ;
30
22
31
- if ( ! this . Dependencies . ContainsKey ( path ) )
32
- this . Dependencies [ path ] = new WebCompiler . Dependencies ( ) ;
23
+ if ( ! Dependencies . ContainsKey ( path ) )
24
+ Dependencies [ path ] = new Dependencies ( ) ;
33
25
34
26
//remove the dependencies registration of this file
35
27
this . Dependencies [ path ] . DependentOn = new HashSet < string > ( ) ;
36
28
//remove the dependentfile registration of this file for all other files
37
- foreach ( var dependenciesPath in this . Dependencies . Keys )
29
+ foreach ( var dependenciesPath in Dependencies . Keys )
38
30
{
39
31
var lowerDependenciesPath = path . ToLowerInvariant ( ) ;
40
- if ( this . Dependencies [ lowerDependenciesPath ] . DependentFiles . Contains ( path ) )
32
+ if ( Dependencies [ lowerDependenciesPath ] . DependentFiles . Contains ( path ) )
41
33
{
42
- this . Dependencies [ lowerDependenciesPath ] . DependentFiles . Remove ( path ) ;
34
+ Dependencies [ lowerDependenciesPath ] . DependentFiles . Remove ( path ) ;
43
35
}
44
36
}
45
37
@@ -50,17 +42,17 @@ public override void UpdateFileDependencies(string path)
50
42
var matches = System . Text . RegularExpressions . Regex . Matches ( content , "@import\\ s+(url\\ ()?(['\" ])(.*?)(\\ 2)\\ )?;" ) ;
51
43
foreach ( System . Text . RegularExpressions . Match match in matches )
52
44
{
53
- FileInfo importedfile = new FileInfo ( System . IO . Path . Combine ( info . DirectoryName , match . Groups [ 3 ] . Value ) ) ;
45
+ FileInfo importedfile = new FileInfo ( Path . Combine ( info . DirectoryName , match . Groups [ 3 ] . Value ) ) ;
54
46
var dependencyFilePath = importedfile . FullName . ToLowerInvariant ( ) ;
55
47
56
- if ( ! this . Dependencies [ path ] . DependentOn . Contains ( dependencyFilePath ) )
57
- this . Dependencies [ path ] . DependentOn . Add ( dependencyFilePath ) ;
48
+ if ( ! Dependencies [ path ] . DependentOn . Contains ( dependencyFilePath ) )
49
+ Dependencies [ path ] . DependentOn . Add ( dependencyFilePath ) ;
58
50
59
- if ( ! this . Dependencies . ContainsKey ( dependencyFilePath ) )
60
- this . Dependencies [ dependencyFilePath ] = new WebCompiler . Dependencies ( ) ;
51
+ if ( ! Dependencies . ContainsKey ( dependencyFilePath ) )
52
+ Dependencies [ dependencyFilePath ] = new Dependencies ( ) ;
61
53
62
- if ( ! this . Dependencies [ dependencyFilePath ] . DependentFiles . Contains ( path ) )
63
- this . Dependencies [ dependencyFilePath ] . DependentFiles . Add ( path ) ;
54
+ if ( ! Dependencies [ dependencyFilePath ] . DependentFiles . Contains ( path ) )
55
+ Dependencies [ dependencyFilePath ] . DependentFiles . Add ( path ) ;
64
56
}
65
57
}
66
58
}
0 commit comments