wro4j-core/src/main/java/ro/isdc/wro/util/WroUtil.java
public static String toJSMultiLineString(final String data) {
    final StringBuffer result = new StringBuffer("[");
    if (data != null) {
      final String[] lines = data.split("\n");
      if (lines.length == 0) {
        result.append("\"\"");
      }
      for (int i = 0; i < lines.length; i++) {
        final String line = lines[i];
        result.append("\"");
        result.append(line.replace(SEPARATOR_WINDOWS, "\\\\").replace("\"", "\\\"").replaceAll("\\r|\\n", ""));
        // this is used to force a single line to have at least one new line (otherwise cssLint fails).
        if (lines.length == 1) {
          result.append("\\n");
        }
        result.append("\"");
        if (i < lines.length - 1) {
          result.append(",");
        }
      }
    }
    result.append("].join(\"\\n\")");
    return result.toString();
  }
public static String toJSMultiLineString(final String data) {
    final StringBuffer result = new StringBuffer("[");
    if (data != null) {
      final String[] lines = data.split("\n");
      if (lines.length == 0) {
        result.append("\"\"");
      }
      for (int i = 0; i < lines.length; i++) {
        final String line = lines[i];
        result.append("\"");
        result.append(line.replace(SEPARATOR_WINDOWS, "\\\\").replace("\"", "\\\"").replaceAll("\\r|\\n", ""));
        // this is used to force a single line to have at least one new line (otherwise cssLint fails).
        if (lines.length == 1) {
          result.append("\\n");
        }
        result.append("\"");
        if (i < lines.length - 1) {
          result.append(",");
        }
      }
    }
    result.append("].join(\"\\n\")");
    return result.toString();
  }
Transforms a java multi-line string into javascript multi-line string. This technique was found at {@link http
://stackoverflow.com/questions/805107/multiline-strings-in-javascript/}

@param data
a string containing new lines.
@return a string which being evaluated on the client-side will be treated as a correct multi-line string.