apply method
- Environment environment
Load the options and plugins
Implementation
void apply(Environment environment) {
final lessOptions = environment.options;
final logger = environment.logger;
var line = value.value;
if (isPlugin) {
line = '--plugin=$line';
if (pluginArgs != null) line = '$line=$pluginArgs';
}
logger.captureStart();
final result = lessOptions.fromCommandLine(line);
var capture = logger.captureStop();
if (capture.isNotEmpty) capture = capture.split('\n').first;
if (!result) {
throw LessExceptionError(LessError(
message: 'bad options ($capture)',
index: index,
filename: currentFileInfo.filename));
}
if (isPlugin) {
if (lessOptions.pluginManager == null) {
lessOptions.pluginLoader.start();
} else {
// we have added the last plugin, but it is not in pluginManager
lessOptions.pluginManager.addPlugin(lessOptions.plugins.last);
}
}
}