Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 90eba25

Browse files
committed
feat(sassoptions): expose properties
1 parent fbe1f8f commit 90eba25

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/interop/options/sassOptions.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,33 @@ interface SassOptionsInterface {
3939
*/
4040
sourceMapFile: string;
4141

42+
/**
43+
* Property accessor to `sass_option_(get|set)_output_path`
44+
*/
45+
outputPath: string;
46+
/**
47+
* Property accessor to `sass_option_(get|set)_input_path`
48+
*/
49+
inputPath: string;
50+
4251
/**
4352
* Push include path for compilation.
53+
* Accessor to sass_option_push_include_path
54+
*
4455
* @param {string} includePath path to be inlcluded
4556
*/
4657
addIncludePath(includePath: string): void;
4758
/**
4859
* Push include path for plugin.
60+
* Accessor to sass_option_push_plugin_path
61+
*
4962
* @param {string} pluginPath path to be inlcluded
5063
*/
5164
addPluginPath(pluginPath: string): void;
5265

5366
/**
5467
* Release allocated memory with created instance.
68+
* Accessor to sass_delete_options
5569
*/
5670
dispose(): void;
5771
}
@@ -76,8 +90,10 @@ enum OutputStyle {
7690
class SassOptions implements SassOptionsInterface {
7791
/**
7892
* Raw pointer to `struct Sass_Options*`
93+
* @internal
7994
*/
80-
private readonly sassOptionsPtr: number;
95+
public readonly sassOptionsPtr: number;
96+
8197
/**
8298
* List of virtual mounted path.
8399
*/
@@ -160,6 +176,24 @@ class SassOptions implements SassOptionsInterface {
160176
this.cwrapOptions.option_set_source_map_file(this.sassOptionsPtr, this.strMethod.alloc(mapFile));
161177
}
162178

179+
public get outputPath(): string {
180+
const outPathPtr = this.cwrapOptions.option_get_output_path(this.sassOptionsPtr);
181+
return this.strMethod.ptrToString(outPathPtr);
182+
}
183+
184+
public set outputPath(outPath: string) {
185+
this.cwrapOptions.option_set_output_path(this.sassOptionsPtr, this.strMethod.alloc(outPath));
186+
}
187+
188+
public get inputPath(): string {
189+
const inputPathPtr = this.cwrapOptions.option_get_input_path(this.sassOptionsPtr);
190+
return this.strMethod.ptrToString(inputPathPtr);
191+
}
192+
193+
public set inputPath(outPath: string) {
194+
this.cwrapOptions.option_set_input_path(this.sassOptionsPtr, this.strMethod.alloc(outPath));
195+
}
196+
163197
public addIncludePath(includePath: string): void {
164198
const mounted = this.mount(includePath);
165199
this.mountedPath.push(mounted);

0 commit comments

Comments
 (0)