Less_SourceMap_Generator
extends Less_Configurable
in package
Source map generator
Tags
Table of Contents
- VERSION = 3
- What version of source map does the generator generate?
- $contentsMap : array<string|int, mixed>
- Array of contents map
- $defaultOptions : array<string|int, mixed>
- Array of default options
- $encoder : Less_SourceMap_Base64VLQ
- The base64 VLQ encoder
- $mappings : array<string|int, mixed>
- Array of mappings
- $options : array<string|int, mixed>
- Array of options
- $root : Less_Tree_Ruleset
- The root node
- $source_keys : mixed
- $sources : array<string|int, mixed>
- File to content map
- __construct() : mixed
- Constructor
- addMapping() : mixed
- Adds a mapping
- fixWindowsPath() : string
- fix windows paths
- generateCSS() : string
- Generates the CSS
- generateMappings() : string
- Generates the mappings string
- getOption() : mixed
- Get an option value by name
- setOption() : mixed
- Set an option
- setOptions() : mixed
- Set options
- findFileIndex() : int|false
- Finds the index for the filename
- generateJson() : string
- Generates the JSON source map
- getSourcesContent() : array<string|int, mixed>|null
- Returns the sources contents
- normalizeFilename() : string
- Normalizes the filename
- saveMap() : mixed
- Saves the source map to a file
Constants
VERSION
What version of source map does the generator generate?
public
mixed
VERSION
= 3
Properties
$contentsMap
Array of contents map
protected
array<string|int, mixed>
$contentsMap
= array()
$defaultOptions
Array of default options
protected
array<string|int, mixed>
$defaultOptions
= array(
// an optional source root, useful for relocating source files
// on a server or removing repeated values in the 'sources' entry.
// This value is prepended to the individual entries in the 'source' field.
'sourceRoot' => '',
// an optional name of the generated code that this source map is associated with.
'sourceMapFilename' =>
ull,
// url of the map
'sourceMapURL' =>
ull,
// absolute path to a file to write the map to
'sourceMapWriteTo' =>
ull,
// output source contents?
'outputSourceFiles' => alse,
// base path for filename normalization
'sourceMapRootpath' => '',
// base path for filename normalization
'sourceMapBasepath' => '',
)
$encoder
The base64 VLQ encoder
protected
Less_SourceMap_Base64VLQ
$encoder
$mappings
Array of mappings
protected
array<string|int, mixed>
$mappings
= array()
$options
Array of options
protected
array<string|int, mixed>
$options
= array()
$root
The root node
protected
Less_Tree_Ruleset
$root
$source_keys
protected
mixed
$source_keys
= array()
$sources
File to content map
protected
array<string|int, mixed>
$sources
= array()
Methods
__construct()
Constructor
public
__construct(Less_Tree_Ruleset $root, mixed $contentsMap[, array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $root : Less_Tree_Ruleset
-
The root node
- $contentsMap : mixed
- $options : array<string|int, mixed> = array()
-
Array of options
Return values
mixed —addMapping()
Adds a mapping
public
addMapping(int $generatedLine, int $generatedColumn, int $originalLine, int $originalColumn, mixed $fileInfo) : mixed
Parameters
- $generatedLine : int
-
The line number in generated file
- $generatedColumn : int
-
The column number in generated file
- $originalLine : int
-
The line number in original file
- $originalColumn : int
-
The column number in original file
- $fileInfo : mixed
Return values
mixed —fixWindowsPath()
fix windows paths
public
fixWindowsPath(string $path[, mixed $addEndSlash = false ]) : string
Parameters
- $path : string
- $addEndSlash : mixed = false
Return values
string —generateCSS()
Generates the CSS
public
generateCSS() : string
Return values
string —generateMappings()
Generates the mappings string
public
generateMappings() : string
Return values
string —getOption()
Get an option value by name
public
getOption(string $name[, mixed $default = null ]) : mixed
If the option is empty or not set a NULL value will be returned.
Parameters
- $name : string
- $default : mixed = null
-
Default value if confiuration of $name is not present
Return values
mixed —setOption()
Set an option
public
setOption(string $name, mixed $value) : mixed
Parameters
- $name : string
- $value : mixed
Return values
mixed —setOptions()
Set options
public
setOptions(array<string|int, mixed>|object $options) : mixed
If $options is an object it will be converted into an array by called it's toArray method.
Parameters
- $options : array<string|int, mixed>|object
Tags
Return values
mixed —findFileIndex()
Finds the index for the filename
protected
findFileIndex(string $filename) : int|false
Parameters
- $filename : string
Return values
int|false —generateJson()
Generates the JSON source map
protected
generateJson() : string
Tags
Return values
string —getSourcesContent()
Returns the sources contents
protected
getSourcesContent() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —normalizeFilename()
Normalizes the filename
protected
normalizeFilename(string $filename) : string
Parameters
- $filename : string
Return values
string —saveMap()
Saves the source map to a file
protected
saveMap(string $file, string $content) : mixed
Parameters
- $file : string
-
The absolute path to a file
- $content : string
-
The content to write