File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
38
38
'help ' => 'The config file to use. ' ,
39
39
'short ' => 'c ' ,
40
40
'default ' => CONFIG . 'asset_compress.ini ' ,
41
+ ])
42
+ ->addOption ('skip-plugins ' , [
43
+ 'help ' => 'Don \'t load config files from plugin \'s . ' ,
44
+ 'boolean ' => true ,
41
45
]);
42
46
43
47
return $ parser ;
@@ -53,7 +57,10 @@ public function buildOptionParser(ConsoleOptionParser $parser): ConsoleOptionPar
53
57
public function execute (Arguments $ args , ConsoleIo $ io )
54
58
{
55
59
$ configFinder = new ConfigFinder ();
56
- $ config = $ configFinder ->loadAll ($ args ->getOption ('config ' ));
60
+ $ config = $ configFinder ->loadAll (
61
+ $ args ->getOption ('config ' ),
62
+ (bool )$ args ->getOption ('skip-plugins ' )
63
+ );
57
64
$ factory = new Factory ($ config );
58
65
59
66
$ themes = (array )$ config ->general ('themes ' );
Original file line number Diff line number Diff line change @@ -27,9 +27,10 @@ class ConfigFinder
27
27
* will be loaded if it is present.
28
28
*
29
29
* @param string $path The configuration file path to start loading from.
30
+ * @param bool $skipPlugins Whether to skip config files from plugins. Default `false`.
30
31
* @return \MiniAsset\AssetConfig The completed configuration object.
31
32
*/
32
- public function loadAll ($ path = null )
33
+ public function loadAll ($ path = null , $ skipPlugins = false )
33
34
{
34
35
if (!$ path ) {
35
36
$ path = CONFIG . 'asset_compress.ini ' ;
@@ -39,6 +40,10 @@ public function loadAll($path = null)
39
40
]);
40
41
$ this ->_load ($ config , $ path );
41
42
43
+ if ($ skipPlugins ) {
44
+ return $ config ;
45
+ }
46
+
42
47
$ plugins = Plugin::loaded ();
43
48
foreach ($ plugins as $ plugin ) {
44
49
$ pluginConfig = Plugin::path ($ plugin ) . 'config ' . DS . 'asset_compress.ini ' ;
Original file line number Diff line number Diff line change @@ -72,6 +72,18 @@ public function testIniTargets()
72
72
];
73
73
$ result = $ config ->targets ();
74
74
$ this ->assertEquals ($ expected , $ result );
75
+
76
+ $ config = $ configFinder ->loadAll ($ this ->testConfig , true );
77
+
78
+ $ expected = [
79
+ 'libs.js ' ,
80
+ 'foo.bar.js ' ,
81
+ 'new_file.js ' ,
82
+ 'all.css ' ,
83
+ 'pink.css ' ,
84
+ ];
85
+ $ result = $ config ->targets ();
86
+ $ this ->assertEquals ($ expected , $ result );
75
87
}
76
88
77
89
public function testLocalPluginConfig ()
You can’t perform that action at this time.
0 commit comments