Skip to content

Commit

Permalink
Updating docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
peteboere committed Jun 10, 2014
1 parent ce2635d commit 8ffd96d
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 52 deletions.
53 changes: 47 additions & 6 deletions docs/api/functions.md
Expand Up @@ -11,56 +11,97 @@ Process host CSS file and return the compiled file URL.
<code>csscrush_file( string $file [, array [$options](#api--options) ] )</code>


***************

## csscrush_tag()

Process host CSS file and return an HTML link tag with populated href.

<code>csscrush_tag( string $file [, array [$options](#api--options) [, array $attributes ]] )</code>


***************

## csscrush_inline()

Process host CSS file and return CSS as text wrapped in html `style` tags.

<code>csscrush_inline( string $file [, array [$options](#api--options) [, array $attributes ]] )</code>


***************

## csscrush_string()

Compile a raw string of CSS string and return it.

<code>csscrush_string( string $string [, array [$options](#api--options) ] )</code>


## csscrush_stat()
***************

Retrieve statistics from the most recent compiled file. Available stats include `selector_count`, `rule_count` and `compile_time`.
## csscrush\_add_function()

`csscrush_stat()`
Add custom CSS functions.

Custom functions added this way are stored on a stack and used by any
subsequent compilations within the duration of the script.

`csscrush_add_function( string $function_name, callable $callback = null )`

### Parameters

* `$function_name` Name of CSS function, or null to clear all CSS
* `$callback` CSS function callback, or null to remove function named `$function_name`.

`callback ( array $arguments, stdClass $context )`


***************

## csscrush_version()

Get the library version.

`csscrush_version()`
`csscrush_version( [bool $use_git = false] )`

### Parameters

* `$use_git` Return version as reported by shell command `git describe`.


***************

## csscrush_get()

Retrieve a config setting or option default.

`csscrush_get( string $object_name, string $property )`

### Parameters

* `$object_name` Name of object you want to inspect: 'config' or 'options'.
* `$property`

`csscrush_get( string $object_name, string $property )`

***************

## csscrush_set()

Set a config setting or option default.

`csscrush_set( string $object_name, mixed $settings )`

### Parameters

* `$object_name` Name of object you want to modify: 'config' or 'options'.
* `$settings` Assoc array of keys and values to set, or callable which argument is the object specified in `$object_name`.

`csscrush_set( string $object_name, mixed $settings )`

***************

## csscrush_stat()

Get compilation stats from the most recent compiled file.

`csscrush_stat()`
2 changes: 1 addition & 1 deletion docs/core/functions/a-adjust.md
Expand Up @@ -8,7 +8,7 @@ Manipulate the opacity (alpha channel) of a color value.

<code>a-adjust( *color*, *offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`offset`* The percentage to offset the color opacity
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/data-uri.md
Expand Up @@ -8,7 +8,7 @@ Create a data-uri.

<code>data-uri( *url* )</code>

## Params
## Parameters

* *`url`* URL of an asset

Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/h-adjust.md
Expand Up @@ -8,7 +8,7 @@ Adjust the hue of a color value.

<code>h-adjust( *color*, *offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`offset`* The percentage to offset the color hue (percent mark optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/hsl-adjust.md
Expand Up @@ -8,7 +8,7 @@ Manipulate the hue, saturation and lightness of a color value

<code>hsl-adjust( *color*, *hue-offset*, *saturation-offset*, *lightness-offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`hue-offset`* The percentage to offset the color hue
Expand Down
4 changes: 2 additions & 2 deletions docs/core/functions/hsla-adjust.md
Expand Up @@ -6,9 +6,9 @@

Manipulate the hue, saturation, lightness and opacity of a color value.

<code>hsl-adjust( *color*, *hue-offset*, *saturation-offset*, *lightness-offset*, *alpha-offset* = 0 )</code>
<code>hsla-adjust( *color*, *hue-offset*, *saturation-offset*, *lightness-offset*, *alpha-offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`hue-offset`* The percentage to offset the color hue
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/l-adjust.md
Expand Up @@ -8,7 +8,7 @@ Adjust the lightness of a color value.

<code>l-adjust( *color*, *offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`offset`* The percentage to offset the color hue (percent mark optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/percent.md
Expand Up @@ -8,7 +8,7 @@ Calculate a percentage value based on two given values.

<code>percent( *value1*, *value2* [, *precision* = 5] )</code>

## Params
## Parameters

* *`value1`* Number
* *`value2`* Number
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/query.md
Expand Up @@ -8,7 +8,7 @@ Copy a value from another rule.

<code>query( *reference* [, *property-name* = default] [, *fallback*] )</code>

## Params
## Parameters

* *`reference`* A CSS selector to match, or abstract rule name
* *`property-name`* The CSS property name to copy, or just 'default' to pass over. Defaults to the calling property
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/s-adjust.md
Expand Up @@ -8,7 +8,7 @@ Adjust the saturation of a color value.

<code>s-adjust( *color*, *offset* )</code>

## Params
## Parameters

* *`color`* Any valid CSS color value
* *`offset`* The percentage to offset the color hue (percent mark optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/core/functions/this.md
Expand Up @@ -10,7 +10,7 @@ Restricted to referencing properties that don't already reference other properti

<code>this( *property-name*, *fallback* )</code>

## Params
## Parameters

* *`property-name`* Property name
* *`fallback`* A CSS value
Expand Down
13 changes: 6 additions & 7 deletions docs/core/selector-aliases.md
Expand Up @@ -6,18 +6,17 @@

Selector aliases can be useful for grouping together common selector chains for reuse.

They're defined with the `@selector-alias` directive, and can be used anywhere you might use a psuedo class.
They're defined with the `@selector` directive, and can be used anywhere you might use a psuedo class.


```crush
/* Defining selector aliases */
@selector-alias heading :any(h1, h2, h3, h4, h5, h6);
@selector-alias radio input[type="radio"];
@selector-alias hocus :any(:hover, :focus);
@selector heading :any(h1, h2, h3, h4, h5, h6);
@selector radio input[type="radio"];
@selector hocus :any(:hover, :focus);
/* Selector aliases with arguments */
@selector-alias class-prefix :any([class^="#(0)"], [class*=" #(0)"]);
@selector-alias col :class-prefix(-col);
@selector class-prefix :any([class^="#(0)"], [class*=" #(0)"]);
@selector col :class-prefix(-col);
.sidebar :heading {
color: honeydew;
Expand Down
2 changes: 1 addition & 1 deletion docs/plugins/noise.md
Expand Up @@ -17,7 +17,7 @@ noise/turbulence(
)
```

### Params
### Parameters

* **fill-color** - Any valid CSS color value.
* **size** - Pixel size of canvas in format WxH (e.g. 320x480).
Expand Down
37 changes: 10 additions & 27 deletions lib/functions.php
Expand Up @@ -11,9 +11,7 @@ class_alias('CssCrush\Crush', 'CssCrush\CssCrush');
/**
* Process CSS file and return a new compiled file.
*
* @param string $file URL or System path to the host CSS file.
* @param mixed $options An array of options or null.
* @return string The public path to the compiled file or an empty string.
* @see docs/api/functions.md
*/
function csscrush_file($file, $options = array()) {

Expand All @@ -33,10 +31,7 @@ function csscrush_file($file, $options = array()) {
/**
* Process CSS file and return an HTML link tag with populated href.
*
* @param string $file Absolute or relative path to the host CSS file.
* @param mixed $options An array of options or null.
* @param array $tag_attributes An array of HTML attributes.
* @return string HTML link tag or error message inside HTML comment.
* @see docs/api/functions.md
*/
function csscrush_tag($file, $options = array(), $tag_attributes = array()) {

Expand All @@ -57,10 +52,7 @@ function csscrush_tag($file, $options = array(), $tag_attributes = array()) {
/**
* Process CSS file and return CSS as text wrapped in html style tags.
*
* @param string $file Absolute or relative path to the host CSS file.
* @param mixed $options An array of options or null.
* @param array $attributes An array of HTML attributes, set false to return CSS text without tag.
* @return string HTML link tag or error message inside HTML comment.
* @see docs/api/functions.md
*/
function csscrush_inline($file, $options = array(), $tag_attributes = array()) {

Expand Down Expand Up @@ -88,9 +80,7 @@ function csscrush_inline($file, $options = array(), $tag_attributes = array()) {
/**
* Compile a raw string of CSS string and return it.
*
* @param string $string CSS text.
* @param mixed $options An array of options or null.
* @return string CSS text.
* @see docs/api/functions.md
*/
function csscrush_string($string, $options = array()) {

Expand All @@ -107,8 +97,7 @@ function csscrush_string($string, $options = array()) {
/**
* Set default options and config settings.
*
* @param string $object_name Name of object you want to modify: 'config' or 'options'.
* @param mixed $modifier Assoc array of keys and values to set, or callable which is passed the object.
* @see docs/api/functions.md
*/
function csscrush_set($object_name, $modifier) {

Expand All @@ -131,8 +120,7 @@ function csscrush_set($object_name, $modifier) {
/**
* Get default options and config settings.
*
* @param string $object_name Name of object you want to modify: 'config' or 'options'.
* @param mixed $property The property name to retrieve.
* @see docs/api/functions.md
*/
function csscrush_get($object_name, $property = null) {

Expand All @@ -154,14 +142,7 @@ function csscrush_get($object_name, $property = null) {
/**
* Add custom CSS functions.
*
* Custom functions added this way are stored on a stack and used by any
* subsequent compilations within the duration of the script.
*
* @param mixed $function_name Name of CSS function, or null to clear all CSS
* functions added by `csscrush_add_function()`.
* @param mixed $callback CSS function callback, or null to remove function
* named `$function_name`. If CSS function call contains arguments
* they are passed to `$callback` as a string.
* @see docs/api/functions.md
*/
function csscrush_add_function($function_name = null, $callback = null) {

Expand Down Expand Up @@ -194,7 +175,7 @@ function csscrush_add_function($function_name = null, $callback = null) {
/**
* Get version information.
*
* @param string $use_git Return version as reported by command `git describe`.
* @see docs/api/functions.md
*/
function csscrush_version($use_git = false) {

Expand All @@ -207,6 +188,8 @@ function csscrush_version($use_git = false) {

/**
* Get stats from most recent compile.
*
* @see docs/api/functions.md
*/
function csscrush_stat() {

Expand Down

0 comments on commit 8ffd96d

Please sign in to comment.