本文整理了Java中io.bit3.jsass.Output.getCss()
方法的一些代码示例,展示了Output.getCss()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.getCss()
方法的具体详情如下:
包路径:io.bit3.jsass.Output
类名称:Output
方法名:getCss
[英]Get the css output.
[中]获取css输出。
代码示例来源:origin: jooby-project/jooby
StringContext ctx = new StringContext(source, input, null, options);
Output output = new Compiler().compile(ctx);
return filename.endsWith(".map") ? output.getSourceMap() : output.getCss();
} catch (CompilationException x) {
Matcher matcher = LOCATION.matcher(x.getErrorJson());
代码示例来源:origin: geogebra/geogebra
@Override
protected String process(String css, URL resource) throws Exception {
URI inputFile = null;
try {
inputFile = resource.toURI();
} catch (URISyntaxException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
URI outputFile = new File("stylesheet.css").toURI();
Options options = new Options();
options.setOutputStyle(OutputStyle.COMPRESSED);
Output output = new io.bit3.jsass.Compiler().compileString(css,
inputFile, outputFile, options);
return output.getCss();
}
代码示例来源:origin: svenkubiak/mangooio
private static void sassify(File sassFile) {
final File outputFile = getOutputFile(sassFile, Suffix.CSS);
final URI inputURI = sassFile.toURI();
final URI outputURI = outputFile.toURI();
final Compiler compiler = new Compiler();
try {
final Output output = compiler.compileFile(inputURI, outputURI, new Options());
FileUtils.writeStringToFile(outputFile, output.getCss(), Default.ENCODING.toString());
logPreprocess(sassFile, outputFile);
} catch (CompilationException | IOException e) {
LOG.error("Failed to preprocess SASS file", e);
}
}
代码示例来源:origin: com.blossom-project/blossom-ui-common
@Override
public void doCompileAll() throws Exception {
this.cache.clear();
for (Theme theme : registry.getPlugins()) {
for (String filename : FILENAMES) {
final String scssPath = String.format("classpath:/scss/%s.scss", filename);
final URL scssResource = resourceLoader.getResource(scssPath).getURL();
if (null != scssResource) {
final String scssCode = IOUtils.toString(scssResource, StandardCharsets.UTF_8);
Options options = new Options();
options.setImporters(Collections.singleton(new CustomImporter(theme)));
final Compiler compiler = new Compiler();
final Output output = compiler.compileString(
scssCode,
new URI(scssPath),
null,
options
);
cache.put(theme.getName() + "_" + filename, output.getCss());
}
}
}
}
代码示例来源:origin: warmuuh/libsass-maven-plugin
writeContentToFile(outputFilePath, out.getCss());
if (out.getSourceMap() != null) {
writeContentToFile(sourceMapOutputPath, out.getSourceMap());
代码示例来源:origin: com.github.warmuuh/libsass-maven-plugin
writeContentToFile(outputFilePath, out.getCss());
if (out.getSourceMap() != null) {
writeContentToFile(sourceMapOutputPath, out.getSourceMap());
代码示例来源:origin: io.github.javaeden.orchid/OrchidCore
@Override
public String compile(String extension, String input, Object... data) {
if (extension.equals("scss")) {
try {
options.setIsIndentedSyntaxSrc(false);
return new Compiler().compileString(input, options).getCss();
}
catch (CompilationException e) {
e.printStackTrace();
return "";
}
}
else if (extension.equals("sass")) {
try {
options.setIsIndentedSyntaxSrc(true);
return new Compiler().compileString(input, options).getCss();
}
catch (CompilationException e) {
e.printStackTrace();
return "";
}
}
return input;
}
}
代码示例来源:origin: VueGWT/vue-gwt
private String scssToCss(String scss) {
Compiler compiler = new Compiler();
Options options = new Options();
try {
StringContext context = new StringContext(scss, this.htmlTemplateUri, null/*outputPath*/,
options);
Output output = compiler.compile(context);
return output.getCss();
} catch (CompilationException e) {
logger.error("SCSS compile failed: " + e.getErrorText());
throw new RuntimeException(e);
}
}
代码示例来源:origin: mickleroy/aem-sass-compiler
@Override
public void compile(Collection<ScriptResource> scriptResources, Writer out, CompilerContext ctx) throws IOException {
long t0 = System.currentTimeMillis();
for(ScriptResource src : scriptResources) {
String scss = ScriptResourceUtil.retrieveContents(src);
try {
Options options = new Options();
options.getImporters().add(new FileImporter(ctx, src.getName()));
Output output = compiler.compileString(scss, options);
String css = output.getCss();
css = Utils.rewriteUrlsInCss(ctx.getDestinationPath(), src.getName(), css);
out.write(css);
} catch (CompilationException e) {
dumpError(out, src.getName(), e.getErrorMessage());
}
}
long t1 = System.currentTimeMillis();
log.info("Compiled Sass in {}ms", t1 - t0);
}
代码示例来源:origin: io.freefair.gradle/jsass-gradle-plugin
ResourceGroovyMethods.write(realOut, output.getCss());
} else {
getLogger().error("Cannot write into {}", realOut.getParentFile());
代码示例来源:origin: org.daisy.pipeline.modules.braille/css-utils
if (result.getErrorStatus() != 0)
throw new IOException("Could not compile SASS style sheet: " + result.getErrorMessage());
String css = result.getCss();
logger.debug(url + " compiled to:\n\n" + css);
return new ByteArrayInputStream(css.getBytes(StandardCharsets.UTF_8)); }
代码示例来源:origin: io.freefair.gradle/jsass-plugin
ResourceGroovyMethods.write(realOut, output.getCss());
} else {
getLogger().error("Cannot write into {}", realOut.getParentFile());
内容来源于网络,如有侵权,请联系作者删除!