OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library csstool; | 5 library csstool; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'css.dart'; | 8 import 'css.dart'; |
9 import '../lib/file_system.dart'; | 9 import '../lib/file_system.dart'; |
10 import '../lib/file_system_vm.dart'; | 10 import '../lib/file_system_vm.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 return watch.elapsedMilliseconds; | 21 return watch.elapsedMilliseconds; |
22 } | 22 } |
23 | 23 |
24 printStats(num elapsed, [String filename = '']) { | 24 printStats(num elapsed, [String filename = '']) { |
25 print('Parsed ${_GREEN_COLOR}${filename}${_NO_COLOR} in ${elapsed} msec.'); | 25 print('Parsed ${_GREEN_COLOR}${filename}${_NO_COLOR} in ${elapsed} msec.'); |
26 } | 26 } |
27 | 27 |
28 /** | 28 /** |
29 * Run from the `utils/css` directory. | 29 * Run from the `utils/css` directory. |
30 */ | 30 */ |
31 void main() { | 31 void main(List<String> optionsArgs) { |
32 var optionArgs = new Options().arguments; | |
33 assert(optionArgs.length == 2); | 32 assert(optionArgs.length == 2); |
34 | 33 |
35 String sourceFullFn = optionArgs[0]; | 34 String sourceFullFn = optionArgs[0]; |
36 String outputFullFn = optionArgs[1]; | 35 String outputFullFn = optionArgs[1]; |
37 | 36 |
38 String sourcePath; | 37 String sourcePath; |
39 String sourceFilename; | 38 String sourceFilename; |
40 int idxBeforeFilename = sourceFullFn.lastIndexOf('/'); | 39 int idxBeforeFilename = sourceFullFn.lastIndexOf('/'); |
41 if (idxBeforeFilename >= 0) { | 40 if (idxBeforeFilename >= 0) { |
42 sourcePath = sourceFullFn.substring(0, idxBeforeFilename + 1); | 41 sourcePath = sourceFullFn.substring(0, idxBeforeFilename + 1); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 75 |
77 files.writeString(outputFullFn, buff.toString()); | 76 files.writeString(outputFullFn, buff.toString()); |
78 print("Generated file ${outputFullFn}"); | 77 print("Generated file ${outputFullFn}"); |
79 | 78 |
80 // Generate CSS.dart file. | 79 // Generate CSS.dart file. |
81 String genDartClassFile = Generate.dartClass(files, outPath, stylesheet, | 80 String genDartClassFile = Generate.dartClass(files, outPath, stylesheet, |
82 sourceFilename); | 81 sourceFilename); |
83 print("Generated file ${genDartClassFile}"); | 82 print("Generated file ${genDartClassFile}"); |
84 } | 83 } |
85 } | 84 } |
OLD | NEW |