2016-05-24 03:11:09 +02:00
|
|
|
// Copyright 2016 Google Inc. Use of this source code is governed by an
|
|
|
|
// MIT-style license that can be found in the LICENSE file or at
|
|
|
|
// https://opensource.org/licenses/MIT.
|
|
|
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
2016-08-30 07:52:56 +02:00
|
|
|
import 'package:args/args.dart';
|
2016-05-24 03:11:09 +02:00
|
|
|
import 'package:path/path.dart' as p;
|
|
|
|
import 'package:sass/src/parser.dart';
|
2016-08-27 05:03:47 +02:00
|
|
|
import 'package:sass/src/visitor/perform.dart';
|
2016-08-15 08:51:29 +02:00
|
|
|
import 'package:sass/src/visitor/serialize.dart';
|
2016-05-24 03:11:09 +02:00
|
|
|
|
|
|
|
void main(List<String> args) {
|
2016-08-30 07:52:56 +02:00
|
|
|
var argParser = new ArgParser()
|
|
|
|
..addOption('precision', hide: true)
|
|
|
|
..addOption('style',
|
|
|
|
abbr: 's',
|
|
|
|
help: 'Output style.',
|
|
|
|
allowed: ['expanded'],
|
|
|
|
defaultsTo: 'expanded')
|
|
|
|
..addFlag('help',
|
|
|
|
abbr: 'h', help: 'Print this usage information.', negatable: false);
|
|
|
|
var options = argParser.parse(args);
|
|
|
|
|
|
|
|
if (options['help']) {
|
|
|
|
print("Compile Sass to CSS.\n");
|
|
|
|
print("Usage: sass <input>\n");
|
|
|
|
print(argParser.usage);
|
|
|
|
exit(64);
|
|
|
|
}
|
|
|
|
|
|
|
|
var file = options.rest.first;
|
|
|
|
var parser =
|
|
|
|
new Parser(new File(file).readAsStringSync(), url: p.toUri(file));
|
2016-05-28 01:09:03 +02:00
|
|
|
var cssTree = new PerformVisitor().visitStylesheet(parser.parse());
|
2016-08-30 07:52:56 +02:00
|
|
|
var css = toCss(cssTree);
|
|
|
|
if (css.isNotEmpty) print(css);
|
2016-05-24 03:11:09 +02:00
|
|
|
}
|