purgetss 6.2.20 → 6.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/purgetss CHANGED
@@ -73,6 +73,7 @@ program
73
73
  .option('-q, --quotes', 'Keep double quotes in config.js')
74
74
  .option('-r, --random', 'Generates shades from a random color')
75
75
  .option('-s, --single', 'Generate a single color definition')
76
+ .option('-t, --tailwind', 'Log the generated shades with a compatible structure with `tailwind.config.js`')
76
77
  .option('-l, --log', `Log the generated shades instead of saving them`)
77
78
  .option('-j, --json', `Log a JSON compatible structure, to use it in ${chalk.yellow('app/config.json')}`)
78
79
  .description(`Color shades generator from a given hexcolor`)
package/index.js CHANGED
@@ -430,16 +430,16 @@ function shades(args, options) {
430
430
 
431
431
  let colorObject = createColorObject(colorFamily, colorFamily.hexcode, options);
432
432
 
433
- if (alloyProject() && !options.log && !options.json) {
433
+ if (alloyProject(options.tailwind) && !options.log && !options.json) {
434
434
  if (!configFile['theme']['extend']['colors']) configFile['theme']['extend']['colors'] = {};
435
435
  configFile['theme']['extend']['colors'][colorObject.name] = colorObject.shades;
436
436
  fs.writeFileSync(projectsConfigJS, 'module.exports = ' + cleanDoubleQuotes(configFile, options), 'utf8', err => { throw err; });
437
437
  checkIfColorModule();
438
438
  logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(`${colorFamily.hexcode}`)}) saved in`, chalk.yellow('config.js'));
439
- // if (options.module) colorModule();
440
439
  } else if (options.json) {
441
440
  logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(`${colorFamily.hexcode}`)})\n${JSON.stringify(colorObject, null, 2)}`);
442
441
  } else {
442
+ if (options.tailwind) delete colorObject.shades.default
443
443
  logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(`${colorFamily.hexcode}`)})\n${cleanDoubleQuotes({ colors: { [colorObject.name]: colorObject.shades } }, options)}`);
444
444
  }
445
445
  }
@@ -2360,9 +2360,11 @@ function copyFontStyle(vendor) {
2360
2360
  }
2361
2361
 
2362
2362
  //! Check if running inside an Alloy Project
2363
- function alloyProject() {
2363
+ function alloyProject(silent = false) {
2364
2364
  if (!fs.existsSync(cwd + '/app/views')) {
2365
- logger.error('Please make sure you’re running PurgeTSS inside an Alloy Project.');
2365
+ if (!silent) {
2366
+ logger.error('Please make sure you’re running PurgeTSS inside an Alloy Project.');
2367
+ }
2366
2368
 
2367
2369
  return false;
2368
2370
  }
@@ -1,3 +1,4 @@
1
+ // Part of this code comes from https://uicolors.app
1
2
  const ntc = require('ntcjs');
2
3
 
3
4
  let uuidv4 = require('uuid').v4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgetss",
3
- "version": "6.2.20",
3
+ "version": "6.2.22",
4
4
  "description": "An extension for Titanium SDK that contains a set of Tailwind-like classes to easily and quickly create beautifully designed mobile apps.",
5
5
  "main": "index.js",
6
6
  "bin": {