3
3
using System . IO ;
4
4
using System . Linq ;
5
5
using System . Text ;
6
+ using WebCompiler . Helpers ;
6
7
7
8
namespace WebCompiler
8
9
{
@@ -32,6 +33,7 @@ public IEnumerable<CompilerResult> Process(string configFile, IEnumerable<Config
32
33
try
33
34
{
34
35
FileInfo info = new FileInfo ( configFile ) ;
36
+ string directory = info . Directory . FullName ;
35
37
configs = configs ?? ConfigHandler . GetConfigs ( configFile ) ;
36
38
37
39
if ( configs . Any ( ) )
@@ -41,8 +43,16 @@ public IEnumerable<CompilerResult> Process(string configFile, IEnumerable<Config
41
43
{
42
44
if ( force || config . CompilationRequired ( ) )
43
45
{
44
- var result = ProcessConfig ( info . Directory . FullName , config ) ;
45
- list . Add ( result ) ;
46
+ if ( GlobHelper . IsGlobPattern ( config . InputFile ) )
47
+ {
48
+ foreach ( Config matchedConfig in config . Match ( directory ) )
49
+ list . Add ( ProcessConfig ( directory , matchedConfig ) ) ;
50
+ }
51
+ else
52
+ {
53
+ list . Add ( ProcessConfig ( directory , config ) ) ;
54
+ }
55
+
46
56
OnConfigProcessed ( config , list . Count , configs . Count ( ) ) ;
47
57
}
48
58
}
@@ -112,12 +122,11 @@ private IEnumerable<CompilerResult> SourceFileChanged(string configFile,
112
122
// Compile if the file if it's referenced directly in compilerconfig.json
113
123
foreach ( Config config in configs )
114
124
{
115
- string input = Path . Combine ( folder , config . InputFile . Replace ( "/" , "\\ " ) ) ;
116
-
117
- if ( input . Equals ( sourceFile , StringComparison . OrdinalIgnoreCase ) )
125
+ Config matchingConfig = config . Match ( folder , sourceFile ) ;
126
+ if ( matchingConfig != null )
118
127
{
119
- list . Add ( ProcessConfig ( folder , config ) ) ;
120
- compiledFiles . Add ( input . ToLowerInvariant ( ) ) ;
128
+ list . Add ( ProcessConfig ( folder , matchingConfig ) ) ;
129
+ compiledFiles . Add ( matchingConfig . InputFile . ToLowerInvariant ( ) ) ;
121
130
}
122
131
}
123
132
0 commit comments