You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SassCompiler.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.vaadin.sass;
  2. import java.io.File;
  3. import java.io.FileWriter;
  4. import java.io.IOException;
  5. public class SassCompiler {
  6. public static void main(String[] args) throws Exception {
  7. String input = null;
  8. String output = null;
  9. if (args.length == 0) {
  10. System.out
  11. .println("usage: SassCompile <scss file to compile> <css file to write>");
  12. return;
  13. } else if (args.length == 1) {
  14. input = args[0];
  15. } else {
  16. input = args[0];
  17. output = args[1];
  18. }
  19. File inputFile = new File(input);
  20. ScssStylesheet scss = ScssStylesheet.get(inputFile);
  21. scss.compile();
  22. if (output == null) {
  23. System.out.println(scss.toString());
  24. } else {
  25. writeFile(output, scss.toString());
  26. }
  27. }
  28. public static void writeFile(String filename, String output)
  29. throws IOException {
  30. File file = new File(filename);
  31. FileWriter writer = new FileWriter(file);
  32. writer.write(output);
  33. writer.close();
  34. }
  35. }