# SassTask

Extends \Task

Executes Sass for a particular fileset.

If the sass executable is not available, but scssphp is, then use that instead.

category | Tasks
package | phing.tasks.ext
author | Paul Stuart pstuart2@gmail.com
author | Ken Guest kguest@php.net
license | LGPL (see http://www.gnu.org/licenses/lgpl.html)
version | Release: $Id: eb75e99660cf6fe49f68fe568e00aca4a193e31a $
link | SassTask.php

### Methods

## Builds the full path to the output file based on our settings.

    buildOutputFilePath() : string

access | protected

### Response

`string`

## Compile

    compile(string $fullFilePath, string $outputFile, boolean $lUseScssphp) : void

### Arguments

#### $fullFilePath

`string`

Fully qualified filename to compile.

#### $outputFile

`string`

Filename for generated css.

#### $lUseScssphp

`boolean`

Whether to use scssphp compiler.

## Nested creator, creates a FileSet for this task

    createFileSet() : \FileSet

### Response

`\FileSet`

The created fileset object

## Executes the command and returns return code and output.

    executeCommand(string $inputFile, string $outputFile) : array

access | protected
throws |

### Arguments

#### $inputFile

`string`

Input file

#### $outputFile

`string`

Output file

### Response

`array`

array(return code, array with output)

## Indicate if just a syntax check is required.

    getCheck() : boolean

### Response

`boolean`

## Indicate whether style is set to 'coompact'.

    getCompact() : boolean

see | \setCompact

### Response

`boolean`

## Indicate whether style is set to 'compressed'.

    getCompressed() : boolean

see | \setCompressed

### Response

`boolean`

## Indicate whether style is set to 'crunched'.

    getCrunched() : boolean

see | \setCrunched

### Response

`boolean`

## Returns the textual description of the task

    getDescription() : string

inherited

### Response

`string`

The text description of the task

## Return the output encoding.

    getEncoding() : string

### Response

`string`

## Return name/path of sass executable.

    getExecutable() : string

### Response

`string`

## Indicate whether style is set to 'expanded'.

    getExpand() : boolean

see | \setExpand

### Response

`boolean`

## Return extfilter setting.

    getExtfilter() : string

### Response

`string`

## Return flags to be used when running the sass executable.

    getFlags() : string

### Response

`string`

## Return force value.

    getForce() : boolean

### Response

`boolean`

## Return keepsubdirectories value.

    getKeepsubdirectories() : boolean

### Response

`boolean`

## Return line-numbers setting.

    getLineNumbers() : boolean

### Response

`boolean`

## Returns the location within the buildfile this task occurs. Used by {@link BuildException} to give detailed error messages.

    getLocation() : \Location

inherited

### Response

`\Location`

The location object describing the position of this task within the buildfile.

## Indicate whether style is set to 'nested'.

    getNested() : boolean

see | \setNested

### Response

`boolean`

## Get ScssPhp Compiler.

    getNewCompiler() : \Leafo\ScssPhp\Compiler

### Response

`\Leafo\ScssPhp\Compiler`

## Return extension added to output files.

    getNewext() : string

### Response

`string`

## Return noCache value.

    getNoCache() : boolean

### Response

`boolean`

## Return the outputpath value.

    getOutputpath() : string

### Response

`string`

## Returns the owning target of this task.

    getOwningTarget() : \Target

inherited

### Response

`\Target`

The target object that owns this task

## Return the SASS import path.

    getPath() : string

### Response

`string`

## Returns a reference to current project

    getProject() : \Project

inherited

### Response

`\Project`

Reference to current porject object

## Returns a name

    getRegisterSlot(string $slotName) : \RegisterSlot

inherited

### Arguments

#### $slotName

`string`

### Response

`\RegisterSlot`

## Return removeoldext value (true/false)

    getRemoveoldext() : boolean

### Response

`boolean`

## Returns the wrapper object for runtime configuration

    getRuntimeConfigurableWrapper() : \RuntimeConfigurable

inherited

### Response

`\RuntimeConfigurable`

The wrapper object used by this task

## Return style used for generating output.

    getStyle() : string

### Response

`string`

## Returns the name of task, used only for log messages

    getTaskName() : string

inherited

### Response

`string`

Name of this task

## Returns the name of the task under which it was invoked, usually the XML tagname

    getTaskType() : string

inherited

### Response

`string`

The type of this task (XML Tag)

## Return trace option.

    getTrace() : boolean

### Response

`boolean`

## Return unix-newlines setting

    getUnixnewlines() : boolean

### Response

`boolean`

## Called by the parser to let the task initialize properly.

    init()

inherited

Should throw a BuildException if something goes wrong with the build

This is abstract here, but may not be overloaded by subclasses.

throws |

## Initialise and return an instance of the ScssPhp Compiler.

    initialiseScssphp() : \Leafo\ScssPhp\Compiler

### Response

`\Leafo\ScssPhp\Compiler`

## Pull in scssphp package, return true if successful.

    loadScssphp() : boolean

### Response

`boolean`

## Logs a message with the given priority.

    log(string $msg, integer $level = \Project::MSG_INFO) : void

inherited

### Arguments

#### $msg

`string`

The message to be logged.

#### $level

`integer`

The message's priority at this message should have

## Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.

    main()

inherited abstract

Should throw a BuildException if someting goes wrong with the build

This is abstract here. Must be overloaded by real tasks.

## Configure this task if it hasn't been done already.

    maybeConfigure()

inherited

## Perfrom this task

    perform()

inherited

throws |

## Compile a specified file.

    processFile(boolean $useScssphp) : void

If output file is not specified, but outputpath is, place output in that directory. If neither is specified, place .css file in the directory that the input file is in.

### Arguments

#### $useScssphp

`boolean`

Whether to use the scssphp compiler.

## Process filesets - compiling/generating css files as required.

    processFilesets(boolean $useScssphp) : void

### Arguments

#### $useScssphp

`boolean`

Whether to use the scssphp compiler.

## Whether to just check syntax.

    setCheck(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Set style to compact

    setCompact(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Set style to compressed

    setCompressed(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Set style to crunched. Supported by scssphp only.

    setCrunched(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Sets a textual description of the task

    setDescription(string $desc)

inherited

### Arguments

#### $desc

`string`

The text describing the task

## Set default encoding

    setEncoding(string $encoding) : void

### Arguments

#### $encoding

`string`

Default encoding to use.

## Sets the executable to use for sass. Default: sass

    setExecutable(string $executable) : void

The default assumes sass is in your path. If not you can provide the full path to sass.

access | public

### Arguments

#### $executable

`string`

Name/path of sass executable

## Set style to expanded

    setExpand(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Sets the extfilter. Default: <none>

    setExtfilter(string $extfilter) : void

This will filter the fileset to only process files that match this extension. This could also be done with the fileset.

access | public

### Arguments

#### $extfilter

`string`

Extension to filter for.

## Sets the failonerror flag. Default: true

    setFailonerror(string $failonerror) : void

access | public

### Arguments

#### $failonerror

`string`

Jenkins style boolean value

## Set single filename to compile from scss to css.

    setFile(string $file) : void

### Arguments

#### $file

`string`

Single filename to compile.

## Additional flags to pass to sass.

    setFlags(string $flags) : void

Command will be: sass {$flags} {$inputfile} {$outputfile}

access | public

### Arguments

#### $flags

`string`

List of flags accepted by sass.

## Whether to force recompiled when --update is used.

    setForce(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Set input file (For example style.scss)

    setInput(string $file) : void

Synonym for @see setFile

### Arguments

#### $file

`string`

Filename

## Sets the keepsubdirectories value. Default: true

    setKeepsubdirectories(boolean $keepsubdirectories) : void

When set to true we will keep the directory structure. So any input files in subdirectories will have their output file in that same sub-directory. If false, all output files will be put in the path defined by outputpath or in the directory top directory of the fileset.

access | public

### Arguments

#### $keepsubdirectories

`boolean`

Jenkins style boolean

## Whether to identify source-file and line number for generated CSS.

    setLineNumbers(string $lineNumbers) : void

### Arguments

#### $lineNumbers

`string`

Jenkins style boolean value

## Sets the location within the buildfile this task occurs. Called by the parser to set location information.

    setLocation(\Location $location)

inherited

### Arguments

#### $location

`\Location`

The location object describing the position of this task within the buildfile.

## Set style to nested

    setNested(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Sets the newext value. Default: css

    setNewext(string $newext) : void

This is the extension we will add on to the output file regardless of if we remove the old one or not.

access | public

### Arguments

#### $newext

`string`

New extension to use, e.g. css

## Whether to cache parsed sass files.

    setNoCache(string $value) : void

### Arguments

#### $value

`string`

Jenkins style boolean value

## Set name of output file.

    setOutput(string $file) : void

### Arguments

#### $file

`string`

Filename of [css] to output.

## Sets the outputpath value. Default: <none>

    setOutputpath(string $outputpath) : void

This will force the output path to be something other than the path of the fileset used.

access | public

### Arguments

#### $outputpath

`string`

Path name

## Sets the owning target this task belongs to.

    setOwningTarget(\Target $target)

inherited

### Arguments

#### $target

`\Target`

## Specify SASS import path

    setPath(string $path) : void

### Arguments

#### $path

`string`

Import path.

## References the project to the current component.

    setProject(\Project $project) : void

inherited

### Arguments

#### $project

`\Project`

The reference to the current project

## Sets the removeoldext flag. Default: true

    setRemoveoldext(string $removeoldext) : void

This will cause us to strip the existing extension off the output file.

access | public

### Arguments

#### $removeoldext

`string`

Jenkins style boolean value

## Sets the wrapper object this task should use for runtime configurable elements.

    setRuntimeConfigurableWrapper(\RuntimeConfigurable $wrapper)

inherited

### Arguments

#### $wrapper

`\RuntimeConfigurable`

The wrapper object this task should use

## Set output style.

    setStyle(mixed $style) : void

### Arguments

#### $style

`mixed`

Style.

## Sets the name of this task for log messages

    setTaskName(string $name) : string

inherited

### Arguments

#### $name

`string`

### Response

`string`

A string representing the name of this task for log

## Sets the type of the task. Usually this is the name of the XML tag

    setTaskType( $name)

inherited

### Arguments

#### $name

``

## Set trace option.

    setTrace(string $trace) : void

IE: Whether to output a stack trace on error.

### Arguments

#### $trace

`string`

Jenkins style boolean value

## Whether to use unix-style newlines.

    setUnixnewlines(string $newlines) : void

### Arguments

#### $newlines

`string`

Jenkins style boolean value

## Whether to use the 'sass' command line tool.

    setUseSass(string $value) : void

link | http://sass-lang.com/install

### Arguments

#### $value

`string`

Jenkins style boolean value.

## Whether to use the scssphp compiler.

    setUseScssphp(string $value) : void

link | http://leafo.github.io/scssphp/

### Arguments

#### $value

`string`

Jenkins style boolean value.

### Properties

## Style to generate to.

    style : string

var |

### Type(s)

`string`

## Stack trace on error.

    trace : boolean

var |

### Type(s)

`boolean`

## Unix-style newlines?

    unixnewlines : boolean

var |

### Type(s)

`boolean`

## Encoding

    encoding : string

var |

### Type(s)

`string`

## SASS import path.

    loadPath : string

var |

### Type(s)

`string`

## Whether to just check syntax

    check : boolean

var |

### Type(s)

`boolean`

## Whether to use the sass command line tool.

    useSass : boolean

var |

### Type(s)

`boolean`

## Whether to use the scssphp compiler, if available.

    useScssphp : boolean

var |

### Type(s)

`boolean`

## Input filename if only processing one file is required.

    file : string|null

var |

### Type(s)

`string|null`

## Output filename

    output : string|null

var |

### Type(s)

`string|null`

## Scssphp compiler

    scssCompiler : object

var |

### Type(s)

`object`

## Contains the path info of our file to allow us to parse.

    pathInfo : array

var |

### Type(s)

`array`

## The Sass executable.

    executable : string

var |

### Type(s)

`string`

## The ext type we are looking for when Verifyext is set to true.

    extfilter : string

More than likely should be "scss" or "sass".

var |

### Type(s)

`string`

## This flag means 'note errors to the output, but keep going'

    failonerror : boolean

var |

### Type(s)

`boolean`

## The fileset we will be running Sass on.

    filesets : array

var |

### Type(s)

`array`

## Additional flags to pass to sass.

    flags : string

var |

### Type(s)

`string`

## Indicates if we want to keep the directory structure of the files.

    keepsubdirectories : boolean

var |

### Type(s)

`boolean`

## When true we will remove the current file ext.

    removeoldext : boolean

var |

### Type(s)

`boolean`

## The new ext our files will have.

    newext : string

var |

### Type(s)

`string`

## The path to send our output files to.

    outputpath : string

If not defined they will be created in the same directory the input is from.

var |

### Type(s)

`string`

## Owning Target object

    target : \Target

inherited

var |

### Type(s)

`\Target`

## Description of the task

    description : string

inherited

var |

### Type(s)

`string`

## Internal taskname (req)

    taskType : string

inherited

var |

### Type(s)

`string`

## Taskname for logger

    taskName : string

inherited

var |

### Type(s)

`string`

## Stored buildfile location

    location : \Location

inherited

var |

### Type(s)

`\Location`

## Wrapper of the task

    wrapper : \RuntimeConfigurable

inherited

var |

### Type(s)

`\RuntimeConfigurable`

## Holds a reference to the project that a project component (a task, a target, etc.) belongs to

    project : \Project

inherited

var | A reference to the current project instance

### Type(s)

`\Project`