In Ionic 2, I would like to access the $colors variables from the file \"[my project]\\src\\theme\\variables.scss\".
This file contains:
In Windows, I used the following taken from Bersling's answer.
npm i --save-dev ruoqianfengshao/scss-to-json
npm i --save-dev node-sass
"scripts": {
...
"scss2json": "echo export const SCSS_VARS = > .\\src\\app\\scss-variables.generated.ts && scss-to-json .\\src\\app\\_variables.scss >> .\\src\\app\\scss-variables.generated.ts"
}
npm run scss2json
import {SCSS_VARS} from './scss-variables.generated';
...
console.log(SCSS_VARS['$color-primary-1']);