當前位置: 首頁>>代碼示例>>Java>>正文


Java OutputRenamingMapFormat類代碼示例

本文整理匯總了Java中com.google.common.css.OutputRenamingMapFormat的典型用法代碼示例。如果您正苦於以下問題:Java OutputRenamingMapFormat類的具體用法?Java OutputRenamingMapFormat怎麽用?Java OutputRenamingMapFormat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OutputRenamingMapFormat類屬於com.google.common.css包,在下文中一共展示了OutputRenamingMapFormat類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: process

import com.google.common.css.OutputRenamingMapFormat; //導入依賴的package包/類
@Override
protected void process() throws IOException, MojoExecutionException {
  if (!changed) { return; }
  File jsRenameMap = getJsRenameMap();

  Files.createParentDirs(jsRenameMap);
  try (OutputStream out = new FileOutputStream(jsRenameMap)) {
    try (Writer writer = new OutputStreamWriter(out, Charsets.UTF_8)) {
      writer.write("// Autogenerated by ");
      writer.write(getClass().getName());
      writer.write("\n");

      OutputRenamingMapFormat.CLOSURE_COMPILED_BY_WHOLE.writeRenamingMap(
          context.substitutionMapProvider.get().getMappings(),
          writer);
      // TODO: freeze the renaming map so no new entries can be added.
    }
  } catch (IOException ex) {
    throw new MojoExecutionException(
        "Failed to link CSS rename map to JS", ex);
  }
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:23,代碼來源:LinkCssNameMap.java

示例2: StableCssSubstitutionMapProvider

import com.google.common.css.OutputRenamingMapFormat; //導入依賴的package包/類
/**
 * @param backingFile a file that need not exist, but if it does, contains
 *     the content of the renaming map as formatted by
 *     {@link OutputRenamingMapFormat#JSON}..
 */
public StableCssSubstitutionMapProvider(File backingFile)
throws IOException {
  CharSource renameMapJson = Files.asCharSource(backingFile, Charsets.UTF_8);
  RecordingSubstitutionMap.Builder substitutionMapBuilder =
      new RecordingSubstitutionMap.Builder()
      .withSubstitutionMap(
          new MinimalSubstitutionMap());
  ImmutableMap<String, String> mappings = ImmutableMap.of();
  try {
    try (Reader reader = renameMapJson.openBufferedStream()) {
      mappings = OutputRenamingMapFormat.JSON.readRenamingMap(reader);
    }
  } catch (@SuppressWarnings("unused") FileNotFoundException ex) {
    // Ok.  Start with an empty map.
  }

  substitutionMapBuilder.withMappings(mappings);

  this.substitutionMap = substitutionMapBuilder.build();
  this.backingFile = backingFile;
  this.originalMappings = mappings;
}
 
開發者ID:mikesamuel,項目名稱:closure-maven-plugin,代碼行數:28,代碼來源:StableCssSubstitutionMapProvider.java

示例3: visit

import com.google.common.css.OutputRenamingMapFormat; //導入依賴的package包/類
@Override
public void visit(GssOutputRenamingMapFormat n, Object ctx)
		throws Exception {
	super.visit(n, ctx);
	switch (n) {
	case CLOSURE_COMPILED:
		gssOptions
				.setOutputRenamingMapFormat(OutputRenamingMapFormat.CLOSURE_COMPILED);
		break;
	case CLOSURE_COMPILED_SPLIT_HYPHENS:
		gssOptions
				.setOutputRenamingMapFormat(OutputRenamingMapFormat.CLOSURE_COMPILED_SPLIT_HYPHENS);
		break;
	case CLOSURE_UNCOMPILED:
		gssOptions
				.setOutputRenamingMapFormat(OutputRenamingMapFormat.CLOSURE_UNCOMPILED);
		break;
	case JSCOMP_VARIABLE_MAP:
		gssOptions
				.setOutputRenamingMapFormat(OutputRenamingMapFormat.JSCOMP_VARIABLE_MAP);
		break;
	case JSON:
		gssOptions.setOutputRenamingMapFormat(OutputRenamingMapFormat.JSON);
		break;
	case PROPERTIES:
		gssOptions
				.setOutputRenamingMapFormat(OutputRenamingMapFormat.PROPERTIES);
		break;
	}
}
 
開發者ID:DigiArea,項目名稱:closurefx-builder,代碼行數:31,代碼來源:Closurer.java


注:本文中的com.google.common.css.OutputRenamingMapFormat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。