Permalink
Browse files

Untabbifying project.

Github uses 8-tab spaces in code view, I use 4. Most PHP open source projects use 4-space indentation so making the jump.
  • Loading branch information...
peteboere committed Nov 8, 2012
1 parent cd804d5 commit 48319937169a1d74af5e05faffe57462022d1b2c
Showing with 4,727 additions and 4,730 deletions.
  1. +206 −206 Aliases.ini
  2. +31 −32 Prepend.css
  3. +77 −77 cli.php
  4. +22 −22 composer.json
  5. +188 −188 lib/Color.php
  6. +477 −477 lib/Core.php
  7. +288 −288 lib/Function.php
  8. +40 −40 lib/Hook.php
  9. +232 −232 lib/IO.php
  10. +368 −368 lib/Importer.php
  11. +201 −201 lib/Mixin.php
  12. +36 −36 lib/Plugin.php
  13. +932 −932 lib/Process.php
  14. +107 −107 lib/Regex.php
  15. +794 −794 lib/Rule.php
  16. +440 −440 lib/Util.php
  17. +17 −17 plugins/hsl-to-hex.php
  18. +16 −17 plugins/ie-clip.php
  19. +33 −33 plugins/ie-filter.php
  20. +17 −17 plugins/ie-inline-block.php
  21. +14 −14 plugins/ie-min-height.php
  22. +23 −23 plugins/ie-opacity.php
  23. +19 −19 plugins/initial.php
  24. +113 −114 plugins/property-sorter.php
  25. +32 −32 plugins/rgba-fallback.php
  26. +4 −4 plugins/spiffing.php
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -3,39 +3,38 @@
Prepend.css contains library variables by default, but it could also contain reset styles such as reset.css or normalize.css that you would want prepended to every output file.
*/
-
@define {
- /* Font stacks
-
- Sources:
- http://cssfontstack.com
- http://www.codestyle.org
- ---------------------------------------- */
-
- /* Serif */
- baskerville: Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif;
- georgia: Georgia, Times, "Times New Roman", serif;
- palatino: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
- times: TimesNewRoman, "Times New Roman", Times, serif;
-
- /* Sans-serif */
- arial: Arial, Helvetica, sans-serif;
- arial-narrow: "Arial Narrow", Arial, sans-serif;
- gill-sans: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
- helvetica: "Helvetica Neue", Helvetica, Arial, sans-serif;
- lucida: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, sans-serif;
- trebuchet-ms: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
- verdana: Verdana, Geneva, sans-serif;
-
- /* Monospace */
- consolas: Consolas, Monaco, monospace;
- courier: "Courier New", Courier, monospace;
- monaco: Monaco, Consolas, "Lucida Console", monospace;
-
- /* Generic defaults */
- serif: $( times );
- sans-serif: $( arial );
- monospace: $( courier );
+ /* Font stacks
+
+ Sources:
+ http://cssfontstack.com
+ http://www.codestyle.org
+ ---------------------------------------- */
+
+ /* Serif */
+ baskerville: Baskerville, "Baskerville Old Face", "Hoefler Text", Garamond, "Times New Roman", serif;
+ georgia: Georgia, Times, "Times New Roman", serif;
+ palatino: Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
+ times: TimesNewRoman, "Times New Roman", Times, serif;
+
+ /* Sans-serif */
+ arial: Arial, Helvetica, sans-serif;
+ arial-narrow: "Arial Narrow", Arial, sans-serif;
+ gill-sans: "Gill Sans", "Gill Sans MT", Calibri, sans-serif;
+ helvetica: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ lucida: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, sans-serif;
+ trebuchet-ms: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
+ verdana: Verdana, Geneva, sans-serif;
+
+ /* Monospace */
+ consolas: Consolas, Monaco, monospace;
+ courier: "Courier New", Courier, monospace;
+ monaco: Monaco, Consolas, "Lucida Console", monospace;
+
+ /* Generic defaults */
+ serif: $( times );
+ sans-serif: $( arial );
+ monospace: $( courier );
}
View
154 cli.php
@@ -20,8 +20,8 @@
// Get stdin contents
if ( ! stream_set_blocking( $stdin, false ) ) {
- stderr( 'Failed to disable stdin blocking' );
- exit( STATUS_ERROR );
+ stderr( 'Failed to disable stdin blocking' );
+ exit( STATUS_ERROR );
}
$stdin_contents = stream_get_contents( $stdin );
fclose( $stdin );
@@ -31,17 +31,17 @@
## Helpers
function stderr ( $lines, $closing_newline = true ) {
- global $stderr;
- fwrite( $stderr,
- implode( PHP_EOL, (array) $lines ) . ( $closing_newline ? PHP_EOL : '' )
- );
+ global $stderr;
+ fwrite( $stderr,
+ implode( PHP_EOL, (array) $lines ) . ( $closing_newline ? PHP_EOL : '' )
+ );
}
function stdout ( $lines, $closing_newline = true ) {
- global $stdout;
- fwrite( $stdout,
- implode( PHP_EOL, (array) $lines ) . ( $closing_newline ? PHP_EOL : '' )
- );
+ global $stdout;
+ fwrite( $stdout,
+ implode( PHP_EOL, (array) $lines ) . ( $closing_newline ? PHP_EOL : '' )
+ );
}
@@ -53,38 +53,38 @@ function stdout ( $lines, $closing_newline = true ) {
if ( $version < $required_version ) {
- stderr( array(
- "PHP version $required_version or higher is required to use this tool.",
- "You are currently running PHP version $version" )
- );
- exit( STATUS_ERROR );
+ stderr( array(
+ "PHP version $required_version or higher is required to use this tool.",
+ "You are currently running PHP version $version" )
+ );
+ exit( STATUS_ERROR );
}
##################################################################
## Options
$short_opts = array(
- "f:", // Input file. Defaults to sdtin
- "o:", // Output file. Defaults to stdout
- "p", // Pretty formatting
- 'b', // Output boilerplate
- 'h', // Display help
+ "f:", // Input file. Defaults to sdtin
+ "o:", // Output file. Defaults to stdout
+ "p", // Pretty formatting
+ 'b', // Output boilerplate
+ 'h', // Display help
);
$long_opts = array(
- 'file:', // Input file. Defaults to sdtin
- 'output:', // Output file. Defaults to stdout
- 'pretty', // Pretty formatting
- '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
+ 'file:', // Input file. Defaults to sdtin
+ 'output:', // Output file. Defaults to stdout
+ 'pretty', // Pretty formatting
+ '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 );
@@ -168,14 +168,14 @@ function stdout ( $lines, $closing_newline = true ) {
if ( $version_flag ) {
- stdout( 'CSS Crush ' . csscrush::$config->version );
- exit( STATUS_OK );
+ stdout( 'CSS Crush ' . csscrush::$config->version );
+ exit( STATUS_OK );
}
if ( $help_flag ) {
- stdout( $help );
- exit( STATUS_OK );
+ stdout( $help );
+ exit( STATUS_OK );
}
@@ -186,21 +186,21 @@ function stdout ( $lines, $closing_newline = true ) {
if ( $input_file ) {
- if ( ! file_exists( $input_file ) ) {
- stdout( 'Input file not found' . PHP_EOL );
- exit( STATUS_ERROR );
- }
- $input = file_get_contents( $input_file );
+ if ( ! file_exists( $input_file ) ) {
+ stdout( 'Input file not found' . PHP_EOL );
+ exit( STATUS_ERROR );
+ }
+ $input = file_get_contents( $input_file );
}
elseif ( $stdin_contents ) {
- $input = $stdin_contents;
+ $input = $stdin_contents;
}
else {
- // No input, just output help screen
- stdout( $help );
- exit( STATUS_OK );
+ // No input, just output help screen
+ stdout( $help );
+ exit( STATUS_OK );
}
@@ -214,56 +214,56 @@ function stdout ( $lines, $closing_newline = true ) {
// Enable plugin args
if ( $enable_plugins ) {
- foreach ( $enable_plugins as $arg ) {
- foreach ( preg_split( '!\s*,\s*!', $arg ) as $plugin ) {
- $process_opts[ 'enable' ][] = $plugin;
- }
- }
+ foreach ( $enable_plugins as $arg ) {
+ foreach ( preg_split( '!\s*,\s*!', $arg ) as $plugin ) {
+ $process_opts[ 'enable' ][] = $plugin;
+ }
+ }
}
// Disable plugin args
if ( $disable_plugins ) {
- foreach ( $disable_plugins as $arg ) {
- foreach ( preg_split( '!\s*,\s*!', $arg ) as $plugin ) {
- $process_opts[ 'disable' ][] = $plugin;
- }
- }
+ foreach ( $disable_plugins as $arg ) {
+ foreach ( preg_split( '!\s*,\s*!', $arg ) as $plugin ) {
+ $process_opts[ 'disable' ][] = $plugin;
+ }
+ }
}
// Tracing
if ( $trace_flag ) {
- $process_opts[ 'trace' ] = true;
+ $process_opts[ 'trace' ] = true;
}
// Vendor target args
if ( $vendor_target ) {
- $process_opts[ 'vendor_target' ] = $vendor_target;
+ $process_opts[ 'vendor_target' ] = $vendor_target;
}
// Variables args
if ( $variables ) {
- parse_str( $variables, $in_vars );
- $process_opts[ 'vars' ] = $in_vars;
+ parse_str( $variables, $in_vars );
+ $process_opts[ 'vars' ] = $in_vars;
}
// Resolve a context for URLs
if ( ! $context ) {
- $context = $input_file ? dirname( realpath( $input_file ) ) : null;
+ $context = $input_file ? dirname( realpath( $input_file ) ) : null;
}
// If there is an import context set it to the document root
if ( $context ) {
- $old_doc_root = csscrush::$config->docRoot;
- csscrush::$config->docRoot = $context;
- $process_opts[ 'context' ] = $context;
+ $old_doc_root = csscrush::$config->docRoot;
+ csscrush::$config->docRoot = $context;
+ $process_opts[ 'context' ] = $context;
}
// Process the stream
$output = csscrush::string( $input, $process_opts );
// Reset the document root after processing
if ( $context ) {
- csscrush::$config->docRoot = $old_doc_root;
+ csscrush::$config->docRoot = $old_doc_root;
}
@@ -272,24 +272,24 @@ function stdout ( $lines, $closing_newline = true ) {
if ( $output_file ) {
- if ( ! @file_put_contents( $output_file, $output ) ) {
+ if ( ! @file_put_contents( $output_file, $output ) ) {
- $message[] = "Could not write to path '$output_file'";
+ $message[] = "Could not write to path '$output_file'";
- if ( strpos( $output_file, '~' ) === 0 ) {
- $message[] = 'Tilde expansion does not work here';
- }
+ if ( strpos( $output_file, '~' ) === 0 ) {
+ $message[] = 'Tilde expansion does not work here';
+ }
- stderr( $message );
- exit( STATUS_ERROR );
- }
+ stderr( $message );
+ exit( STATUS_ERROR );
+ }
}
else {
- if ( csscrush::$process->errors ) {
- stderr( csscrush::$process->errors );
- }
+ if ( csscrush::$process->errors ) {
+ stderr( csscrush::$process->errors );
+ }
- stdout( $output );
- exit( STATUS_OK );
+ stdout( $output );
+ exit( STATUS_OK );
}
View
@@ -1,24 +1,24 @@
{
- "name": "css-crush/css-crush",
- "type": "library",
- "description": "CSS preprocessor",
- "keywords": ["css", "preprocessor"],
- "homepage": "http://the-echoplex.net/csscrush",
- "license": "MIT",
- "authors": [
- {
- "name": "Pete Boere",
- "email": "pete@the-echoplex.net"
- },
- {
- "name": "GitHub contributors",
- "homepage": "https://github.com/peteboere/css-crush/contributors"
- }
- ],
- "require": {
- "php": ">=5.2.4"
- },
- "autoload": {
- "files": ["CssCrush.php"]
- }
+ "name": "css-crush/css-crush",
+ "type": "library",
+ "description": "CSS preprocessor",
+ "keywords": ["css", "preprocessor"],
+ "homepage": "http://the-echoplex.net/csscrush",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Pete Boere",
+ "email": "pete@the-echoplex.net"
+ },
+ {
+ "name": "GitHub contributors",
+ "homepage": "https://github.com/peteboere/css-crush/contributors"
+ }
+ ],
+ "require": {
+ "php": ">=5.2.4"
+ },
+ "autoload": {
+ "files": ["CssCrush.php"]
+ }
}
Oops, something went wrong.

2 comments on commit 4831993

@amercier

This comment has been minimized.

Show comment Hide comment
@amercier

amercier Jan 11, 2013

Hi,

What would be the reasons to "untabbify" a project?
By that, I don't mean I find this is good or bad, but is there any rationale behind this?

If you have any, I (and perhaps many other developers) would be very interested in hearing this.

Thanks,
A. Mercier

Hi,

What would be the reasons to "untabbify" a project?
By that, I don't mean I find this is good or bad, but is there any rationale behind this?

If you have any, I (and perhaps many other developers) would be very interested in hearing this.

Thanks,
A. Mercier

@peteboere

This comment has been minimized.

Show comment Hide comment
@peteboere

peteboere Jan 11, 2013

Owner

Most PHP projects use spaces over tabs (PEAR coding style guide requires it), so it's good to have a format that the majority of the PHP community prefers.

The main objective reason for spaces over tabs though is consistent readability; Long lines of code often have to be broken and visually aligned for best readability. Using tabs for this works fine as long as everyone is viewing the code with the same tab size, though in practice they never are.

Github displays tabs in code view with traditional 8-space tabs, most tabbing programmers will use anything from 1-8 space tabs. So you see, code can potentially be harder to read if edits are made by multiple developers each aligning their line breaks with different numbers of differently sized tabs. Using spaces the code is always aligned the same in every editor as the author intended.

Owner

peteboere replied Jan 11, 2013

Most PHP projects use spaces over tabs (PEAR coding style guide requires it), so it's good to have a format that the majority of the PHP community prefers.

The main objective reason for spaces over tabs though is consistent readability; Long lines of code often have to be broken and visually aligned for best readability. Using tabs for this works fine as long as everyone is viewing the code with the same tab size, though in practice they never are.

Github displays tabs in code view with traditional 8-space tabs, most tabbing programmers will use anything from 1-8 space tabs. So you see, code can potentially be harder to read if edits are made by multiple developers each aligning their line breaks with different numbers of differently sized tabs. Using spaces the code is always aligned the same in every editor as the author intended.

Please sign in to comment.