Skip to content

Instantly share code, notes, and snippets.

View shaharkazaz's full-sized avatar

Shahar Kazaz shaharkazaz

View GitHub Profile
.some-class {
font-size: var(--text12);
}
import { coreStyles } from '/some/path/variabless';
Highcharts.setOptions({
colors: Object.values(coreStyles.lightTheme.value)
});
@import 'assets/styles/theme.css';
const fontSizes = [10, 12, 14 , ...];
const coreStyles = {
fontSize: {
variableName: 'text:valueKey',
properties: [{
prop: 'font-size',
selector: '.text:valueKey'
}],
value: fontSizes.reduce((acc, size) => {
acc[size] = `${size / 16}rem`;
const coreStyles = {
fontSize: {
variableName: 'text:valueKey',
properties: [{
prop: 'font-size',
selector: '.text:valueKey'
}],
value: {
10: '0.625rem',
12: '0.75rem',
@shaharkazaz
shaharkazaz / variabless-webpack.config.js
Last active July 29, 2021 11:49
Variabless webpack plugin
const { VariablessWebpackPlugin } = require('variabless/webpack-plugin');
module.exports = {
plugins: [
new VariablessWebpackPlugin({
watch?: boolean, // listen to changes
srcPath: 'src/variabless.ts', // the variables rules file
outputPath: 'src/assets/styles/theme.css', // generated css file path
}),
]
@shaharkazaz
shaharkazaz / theme.ts
Last active April 15, 2021 18:23
Variabless definitions file
export const coreStyles: Record<string, Rule> = {
myVariable: {
value: string | object,
variableName?: string | Resolver,
appendVariablesTo?: string,
properties?: PropertyConfig[],
},
...
};
@shaharkazaz
shaharkazaz / en.json
Created July 17, 2020 06:58
Transloco functional transpiler syntax escaping a comma
{
"title": "[[ someFunc(Hello {{user}}\\, welcome ,...) ]]",
}
@shaharkazaz
shaharkazaz / en.json
Created July 17, 2020 06:56
Transloco functional translation syntax example
{
"title": "[[ hasFeatureFlag(newDashboards, has flag, missing flag) ]]",
}
@shaharkazaz
shaharkazaz / transloco-root.module.ts
Created July 17, 2020 06:55
Adding the Transloco transpiler function
import { FunctionalTranspiler, TRANSLOCO_TRANSPILER } from '@ngneat/transloco';
import { FeatureFlagResolver } from './has-feature-flag';
@NgModule({
...
providers: [{
provide: TRANSLOCO_TRANSPILER,
useClass: FunctionalTranspiler
},
{