本文整理汇总了Java中com.vaadin.sass.SassCompiler类的典型用法代码示例。如果您正苦于以下问题:Java SassCompiler类的具体用法?Java SassCompiler怎么用?Java SassCompiler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SassCompiler类属于com.vaadin.sass包,在下文中一共展示了SassCompiler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compileTheme
import com.vaadin.sass.SassCompiler; //导入依赖的package包/类
private void compileTheme() {
try {
binder.commit();
ServletContext context = VaadinServlet.getCurrent().getServletContext();
String fullPath = context.getRealPath("/VAADIN/themes/dashboard");
String customScssFileName = fullPath + "/custom.scss";
SassCompiler.writeFile(customScssFileName, module.getModel());
ProcessBuilder processBuilder = new ProcessBuilder("java", "-cp", "../../../WEB-INF/lib/*", "com.vaadin.sass.SassCompiler", "styles.scss", "styles.css");
processBuilder.directory(new File(fullPath));
File error = new File(fullPath, "custom.scss.log");
processBuilder.redirectErrorStream(true);
processBuilder.redirectError(Redirect.PIPE);
Process process = processBuilder.start();
process.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
StringBuilder builder = new StringBuilder();
String line = reader.readLine();
while (line != null) {
builder.append(line);
line = reader.readLine();
}
reader.close();
if (!builder.toString().trim().isEmpty()) {
throw new Exception(builder.toString());
}
} catch (Exception ex) {
logger.log(Level.SEVERE, ex.getMessage(), ex);
Notification.show("Error", ex.getMessage(), Notification.Type.ERROR_MESSAGE);
}
}
示例2: main
import com.vaadin.sass.SassCompiler; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
SassCompiler.main(new String[]{"src/main/resources/VAADIN/themes/" + Version.THEME_MOBILE_VERSION + "/styles.scss",
"src/main/resources/VAADIN/themes/" + Version.THEME_MOBILE_VERSION + "/styles.css"});
Path source = FileSystems.getDefault().getPath("src/main/resources/VAADIN/themes/" + Version.THEME_MOBILE_VERSION + "/", "styles.css");
Path dest = FileSystems.getDefault().getPath("target/classes/VAADIN/themes/" + Version.THEME_MOBILE_VERSION + "/", "styles.css");
Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING);
}
示例3: main
import com.vaadin.sass.SassCompiler; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
SassCompiler.main(new String[]{"src/main/resources/VAADIN/themes/" + Version.THEME_VERSION + "/styles.scss",
"src/main/resources/VAADIN/themes/" + Version.THEME_VERSION +"/styles.css"});
Path source = FileSystems.getDefault().getPath("src/main/resources/VAADIN/themes/" + Version.THEME_VERSION + "/", "styles.css");
Path dest = FileSystems.getDefault().getPath("target/classes/VAADIN/themes/" + Version.THEME_VERSION + "/", "styles.css");
Files.copy(source, dest, StandardCopyOption.REPLACE_EXISTING);
}