Software Developer, Technology Enthusiast, Retro and Husband and Dad based in Melbourne.

Monthly Archives: July 2017

DelphiLibSass – A Delphi wrapper for LibSass

DelphiLibSass is Delphi wrapper around libsass a C/C++ implementation of a Sass compiler.

Based on the version of libsass 3.4 http://libsass.org

DelphiLibSass API is simply composed of a main TDelphiLibSass class:

TDelphiLibSass.ConvertToCss converts a SCSS string to a CSS

1Try
2  FDelphiLibSass := TDelphiLibSass.Create('libsass.dll');
3  FDelphiLibSass.LoadDll;
4 
5  FScssResult := FDelphiLibSass.
6      ConvertToCss('$font-stack: Helvetica, sans-serif; body { font: 100% $font-stack; }');
7 
8  writeln(FScssResult.CSS);
9Finally
10  FScssResult.Free;
11  FDelphiLibSass.Free;
12end;

TDelphiLibSass.ConvertFileToCss converts a SCSS file to a CSS

1Try
2  FDelphiLibSass := TDelphiLibSass.Create('libsass.dll');
3  FDelphiLibSass.LoadDll;
4 
5  FScssResult := FDelphiLibSass.ConvertFileToCss('test.scss');
6 
7  writeln(FScssResult.CSS);
8Finally
9  FScssResult.Free;
10  FDelphiLibSass.Free;
11end;

Basic example on how to use the Delphi wrapper

https://github.com/novuslogic/DelphiLibSass/tree/master/Sample

References

DelphiLibSass
https://github.com/novuslogic/DelphiLibSass/