It's quite easy to write a service which would load the raw scss file using Http.get, then pass the results through a regex which matches the variable definitions, but...
But honestly, I think you're barking up the wrong tree and need to rethink the design. Why do you want to apply the styles manually if you've already got the scss variables (and the CSS classes that use them) compiled and available in the client?
Why can't you define your own CSS classes which map to your grid system and then setting up a binding to the host elements class in order to bind them? It's a bit ugly, since ngClass is a directive, so can't be bound on a host element, but it's doable.
Taking the bootstrap col-<sw>-<colspan> format as an example:
export type ScreenWidth = 'xs' | 'sm' | 'md' | 'lg';
@Directive({
selector: `div[gridColumn]`,
host: {
'[attr.class]': 'hostClasses.join(' ')'
},
changeDetection: ChangeDetectionStrategy.OnPush
})
export class GridColumn {
@Input('gridColumn') screenWidth: ScreenWidth = 'md';
@Input() colSpan: number = 1;
constructor(private _host: ElementRef) {}
get hostClasses(): Array<string> {
let existingClasses = this._host.nativeElement.classList
.filter(cls => !/^col-/.test(cls)
return [
...existingClasses,
`col-${this.screenWidth}-${colSpan}`
];
}
}
Usage would then be:
<div gridColumn="xs" [colSpan]="4"></div>
Which honestly, is about the same readability as <div class="col-xs-4"></div> anyway, so why bother?