Permalink
Browse files

Added trace option to output SASS compatible debug-info stubs for use…

… with tools like FireSass.

Some internal refactoring.
  • Loading branch information...
1 parent 727af5a commit 157b18899783e9a70154cf938cee2dc408721ca6 @peteboere committed Sep 18, 2012
Showing with 252 additions and 74 deletions.
  1. +0 −4 Prepend.css
  2. +24 −6 cli.php
  3. +160 −27 lib/Core.php
  4. +14 −12 lib/IO.php
  5. +30 −15 lib/Importer.php
  6. +1 −1 lib/Mixin.php
  7. +6 −5 lib/Regex.php
  8. +12 −3 lib/Rule.php
  9. +5 −1 lib/Util.php
View
@@ -39,7 +39,3 @@ Prepend.css contains library variables by default, but it could also contain res
monospace: $( courier );
}
-
-
-
-
View
30 cli.php 100644 → 100755
@@ -1,3 +1,4 @@
+#!/usr/bin/env php
<?php
/**
*
@@ -78,10 +79,12 @@ function stdout ( $lines, $closing_newline = true ) {
'boilerplate', // Output boilerplate
'help', // Display help
'version', // Display version
+ 'trace', // Output sass tracing stubs
'vendor-target:', // Vendor target
'variables:', // Map of variable names in an http query string format
'enable:', // List of plugins to enable
'disable:', // List of plugins to disable
+ 'context:', // Context for resolving URLs
);
$opts = getopt( implode( $short_opts ), $long_opts );
@@ -92,10 +95,12 @@ function stdout ( $lines, $closing_newline = true ) {
$boilerplate = @( isset( $opts['b'] ) ?: isset( $opts['boilerplate'] ) );
$help_flag = @( isset( $opts['h'] ) ?: isset( $opts['help'] ) );
$version_flag = @isset( $opts['version'] );
+$trace_flag = @isset( $opts['trace'] );
$vendor_target = @$opts['vendor-target'];
$variables = @$opts['variables'];
$enable_plugins = isset( $opts['enable'] ) ? (array) $opts['enable'] : null;
$disable_plugins = isset( $opts['disable'] ) ? (array) $opts['disable'] : null;
+$context = isset( $opts['context'] ) ? (array) $opts['context'] : null;
##################################################################
@@ -131,6 +136,12 @@ function stdout ( $lines, $closing_newline = true ) {
--disable:
List of plugins to disable
+ --context:
+ Filepath context for resolving URLs
+
+ --trace:
+ Output debug-info stubs compatible with sass development tools
+
--variables:
Map of variable names in an http query string format
@@ -219,6 +230,11 @@ function stdout ( $lines, $closing_newline = true ) {
}
}
+// Tracing
+if ( $trace_flag ) {
+ $process_opts[ 'trace' ] = true;
+}
+
// Vendor target args
if ( $vendor_target ) {
$process_opts[ 'vendor_target' ] = $vendor_target;
@@ -230,21 +246,23 @@ function stdout ( $lines, $closing_newline = true ) {
$process_opts[ 'vars' ] = $in_vars;
}
-$hostfile_context = $input_file ? dirname( realpath( $input_file ) ) : null;
+// Resolve a context for URLs
+if ( ! $context ) {
+ $context = $input_file ? dirname( realpath( $input_file ) ) : null;
+}
// If there is an import context set it to the document root
-if ( $hostfile_context ) {
-
+if ( $context ) {
$old_doc_root = csscrush::$config->docRoot;
- csscrush::$config->docRoot = $hostfile_context;
- $process_opts[ 'context' ] = $hostfile_context;
+ csscrush::$config->docRoot = $context;
+ $process_opts[ 'context' ] = $context;
}
// Process the stream
$output = csscrush::string( $input, $process_opts );
// Reset the document root after processing
-if ( $hostfile_context ) {
+if ( $context ) {
csscrush::$config->docRoot = $old_doc_root;
}
Oops, something went wrong.

0 comments on commit 157b188

Please sign in to comment.