Ejemplo n.º 1
0
  private void writeCSS(String projectName, String dirPath) throws IOException {
    StringBuilder cssFile = new StringBuilder();
    JSCSSCompilationSession cssSession =
        (JSCSSCompilationSession) project.getCSSCompilationSession();
    cssFile.append(cssSession.emitCSS());

    writeFile(dirPath + File.separator + projectName + ".css", cssFile.toString(), false);
  }
Ejemplo n.º 2
0
 private void appendEncodedCSS(String path, String projectName) throws IOException {
   StringBuilder appendString = new StringBuilder();
   appendString.append("\n\n");
   appendString.append(projectName);
   appendString.append(".prototype.cssData = [");
   JSCSSCompilationSession cssSession =
       (JSCSSCompilationSession) project.getCSSCompilationSession();
   String s = cssSession.getEncodedCSS();
   int reqidx = s.indexOf("goog.require");
   if (reqidx != -1) {
     String reqs = s.substring(reqidx);
     s = s.substring(0, reqidx - 1);
     String fileData = readCode(new File(path));
     reqidx = fileData.indexOf("goog.require");
     String after = fileData.substring(reqidx);
     String before = fileData.substring(0, reqidx - 1);
     s = before + reqs + after + appendString.toString() + s;
     writeFile(path, s, false);
   } else {
     appendString.append(s);
     writeFile(path, appendString.toString(), true);
   }
 }