// FIXME ! they should be relativized
if (treatAsCss(node, filename))
return null;
filename = addLessSuffixIfNeeded(filename, urlParams);
LessSource importedSource;
try {
importedSource = source.relativeSource(filename);
} catch (FileNotFound ex) {
problemsHandler.errorFileNotFound(node, filename);
return null;
} catch (CannotReadFile e) {
problemsHandler.errorFileCanNotBeRead(node, filename);
return null;
} catch (StringSourceException ex) {
// imports are relative to current file and we do not know its location
problemsHandler.warnLessImportNoBaseDirectory(node.getUrlExpression());
return null;
}
// import once should not import a file that was already imported
if (isImportOnce(node) && alreadyVisited(importedSource)) {
astManipulator.removeFromBody(node);
return null;
}
importedSources.add(importedSource);
String importedContent;
try {
importedContent = importedSource.getContent();
} catch (FileNotFound e) {
problemsHandler.errorFileNotFound(node, filename);
return null;
} catch (CannotReadFile e) {
problemsHandler.errorFileCanNotBeRead(node, filename);