public static File changeSuffix(File file, String dottedSuffix) { if (file == null) return null; String filename = changeSuffix(file.toString(), dottedSuffix); return new File(filename); }
private String toOutputFilename(String outputDirectory, String inputFilename, String dottedSuffix) { String filename = URIUtils.changeSuffix(inputFilename, dottedSuffix); if (outputDirectory == null || outputDirectory.isEmpty()) { return filename; } if (!outputDirectory.endsWith(SEPARATOR)) { outputDirectory += SEPARATOR; } return outputDirectory + new File(filename).getName(); }
public static FileSource changeSuffix(FileSource source, String dottedSuffix) { if (source == null) return null; return new LessSource.FileSource(changeSuffix(source.getInputFile(), dottedSuffix)); }
private String getCssResultLocationName(Configuration options, LessSource source) { LessSource location = options.getCssResultLocation(); String name = location == null ? null : location.getName(); if (name == null) name = URIUtils.changeSuffix(source.getName(), Constants.CSS_SUFFIX); return name; }
private CompilationResult createCompilationResult(ASTCssNode cssStyleSheet, LessSource lessSource, List<VariableDeclaration> externalVariables, Collection<LessSource> additionalSourceFiles, Configuration options) { LessSource cssDestination = options == null ? null : options.getCssResultLocation(); if (cssDestination == null) { String guessedCssName = URIUtils.changeSuffix(lessSource.getName(), Constants.CSS_SUFFIX); URI guessedURI = URIUtils.changeSuffix(lessSource.getURI(), Constants.CSS_SUFFIX); cssDestination = new LessSource.StringSource("", guessedCssName, guessedURI); } CssPrinter builder = new CssPrinter(lessSource, cssDestination, extractSources(externalVariables), additionalSourceFiles, options); builder.append(cssStyleSheet); StringBuilder css = builder.toCss(); String sourceMap = builder.toSourceMap(); handleSourceMapLink(cssStyleSheet, css, options, lessSource, sourceMap); CompilationResult compilationResult = new CompilationResult(css.toString(), sourceMap, problemsHandler.getWarnings()); return compilationResult; }