Constructor
new Converter(config, pathsopt, eolopt)
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
config |
BDv2~Config | The BDv2 configuration file. |
||
paths |
Converter~Paths |
<optional> |
{} | The file paths. |
eol |
string |
<optional> |
os.EOL | An end of line string. |
- Source:
Members
(readonly) EOL :string
An end of line string.
Type:
- string
- Default Value:
- Source:
file :string
The BDv2 theme's main file.
Type:
- string
- Source:
info :BDv2~Info
The BDv2 config's info object.
Type:
- Source:
meta :BetterDiscord~Meta
The theme's legacy metadata.
Type:
- Source:
name :string
The theme's name.
Type:
- string
- Source:
paths :Converter~Paths
The file paths.
Type:
- Default Value:
- {}
- Source:
- See:
Methods
(protected) _defaultPath(dir, suffix) → {string}
Creates the paths of the destination files when not provided.
Format: dir/ThemeName.suffix.css
.
Parameters:
Name | Type | Description |
---|---|---|
dir |
string | The root directory of the files. |
suffix |
string | The suffix of the destination file. |
- Source:
- See:
Returns:
The default path of the destination file.
- Type
- string
compile(callback, optionsopt)
Compiles the source file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
Converter~CompileCallback | Callback function to execute after compilation. |
||
options |
Object |
<optional> |
{} | Any of node-sass's |
- Source:
- See:
Throws:
Will throw an error when the callback is missing or isn't a function.
toLegacyTheme(optionsopt)
Converts the BDv2 theme to a legacy BD theme and
writes it to the legacyTheme
destination file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{} | Any of node-sass's |
- Source:
- See:
toMinified(optionsopt, metaopt)
Minifies the BDv2 theme and writes it to the minified
destination file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{} | Any of node-sass's |
meta |
Boolean |
<optional> |
false | Whether to add a theme META line to the file. |
- Source:
- See:
toUserStyle(optionsopt, extrasopt)
Converts the BDv2 theme to a UserStyle and
writes it to the userStyle
destination file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
options |
Object |
<optional> |
{} | Any of node-sass's |
extras |
Object |
<optional> |
{} | Extra configuration for the UserStyle. Will override the BDv2 config. |
- Source:
- See:
Type Definitions
CompileCallback(errnullable, cssnullable, indentopt)
Function that's called after compilation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
err |
Error |
<nullable> |
An error that may be thrown by sass. |
css |
string |
<nullable> |
The compiled css. |
indent |
string |
<optional> |
The indent string used. |
- Source:
Paths
Object representing the files' paths.
Type:
- Object
Properties:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
root |
string | The root directory. |
||||||||||||
src |
string | The source file relative to the root. |
||||||||||||
dest |
string | The destination files relative to the root. Properties
|
- Source: