1.0.16 • Published 2 years ago

dynamic-theme-generate v1.0.16

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago
const path = require('path');
const fs = require('fs');
const { generateTheme, getLessVars } = require('../index.js');

const themeVariables = getLessVars(path.join(__dirname, './theme/vars.less'));
const defaultVars = getLessVars(
  './node_modules/antd/lib/style/themes/default.less'
);
const darkVars = {
  ...getLessVars('./node_modules/antd/lib/style/themes/dark.less'),
  '@primary-color': defaultVars['@primary-color']
};

fs.writeFileSync('./public/dark.json', JSON.stringify(darkVars));
fs.writeFileSync('./public/light.json', JSON.stringify(defaultVars));

const options = {
  stylesDir: path.join(__dirname, './theme'),
  antDir: path.join(__dirname, './node_modules/antd'),
  varFile: path.join(__dirname, './theme/vars.less'),
  themeVariables: Array.from(
    new Set([
      ...Object.keys(darkVars),
      ...Object.keys(defaultVars),
      ...Object.keys(themeVariables)
    ])
  ),
  outputFilePath: path.join(__dirname, './public/color.less'),
  prefix: 'main'
};

generateTheme(options)
  .then((less) => {
    console.log('Theme generated successfully');
  })
  .catch((error) => {
    console.log('Error', error);
  });
1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago