purgetss 6.2.3 → 6.2.5
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 +31 -8
- package/dist/tailwind.tss +1 -1
- package/experimental/completions2.js +11 -5
- package/index.js +122 -33
- package/lib/templates/purgetss.config.js +3 -3
- package/lib/templates/tailwind/template.tss +1 -1
- package/package.json +4 -4
package/bin/purgetss
CHANGED
|
@@ -38,7 +38,7 @@ program
|
|
|
38
38
|
.description(`Creates a new Alloy Project with ${chalk.green('PurgeTSS')} configured`)
|
|
39
39
|
.help(`Creates a new Alloy Project with ${chalk.green('PurgeTSS')} configured. You’ll need to have ${chalk.yellow('app.idprefix')} and ${chalk.yellow('app.workspace')} already configured.`)
|
|
40
40
|
.option('-f, --force', 'To overwrite an existing project')
|
|
41
|
-
.option('-t, --tailwind', `
|
|
41
|
+
.option('-t, --tailwind', `Install ${chalk.green('Tailwind CSS')} for Tailwind CSS Intellisense VS Code extension`)
|
|
42
42
|
.option('-v, --vendor <arguments>', `Use any of the following arguments to copy specific font vendors:\n ${chalk.yellow('fa')} = Font Awesome Icons\n ${chalk.yellow('mi')} = Material Icons\n ${chalk.yellow('ms')} = Material Symbols\n ${chalk.yellow('f7')} = Framework7 Icons`)
|
|
43
43
|
.argument('<name>', 'The name of the project')
|
|
44
44
|
.action((args, options, logger) => {
|
|
@@ -68,17 +68,27 @@ program
|
|
|
68
68
|
.command('shades')
|
|
69
69
|
.alias('s')
|
|
70
70
|
.argument('[hexcode]', 'The base hexcode value')
|
|
71
|
-
.argument('[name]', 'Name of the color
|
|
71
|
+
.argument('[name]', 'Name of the color')
|
|
72
|
+
.option('-n, --name', 'Name of the color')
|
|
72
73
|
.option('-q, --quotes', 'Keep double quotes in config.js')
|
|
73
74
|
.option('-r, --random', 'Generates shades from a random color')
|
|
74
75
|
.option('-l, --log', `Log the generated shades instead of saving them`)
|
|
75
76
|
.option('-j, --json', `Log a JSON compatible structure, to use it in ${chalk.yellow('app/config.json')}`)
|
|
76
77
|
.description(`Color shades generator from a given hexcolor`)
|
|
77
|
-
.help(`
|
|
78
|
+
.help(`Generate color shades from a given hexcolor to use in your project`)
|
|
78
79
|
.action((args, options, logger) => {
|
|
79
80
|
purgetss.shades(args, options);
|
|
80
81
|
});
|
|
81
82
|
|
|
83
|
+
program
|
|
84
|
+
.command('color-module')
|
|
85
|
+
.alias('cm')
|
|
86
|
+
.description(`Copy all colors from ${chalk.yellow('config.js')} to your ${chalk.yellow('lib')} folder`)
|
|
87
|
+
.help(`Copy all colors from ${chalk.yellow('theme.colors')} and ${chalk.yellow('theme.extend.colors')} into a CommonJS module to your project's ${chalk.yellow('lib')} folder`)
|
|
88
|
+
.action((args, options, logger) => {
|
|
89
|
+
purgetss.colorModule();
|
|
90
|
+
});
|
|
91
|
+
|
|
82
92
|
program
|
|
83
93
|
.command('watch')
|
|
84
94
|
.alias('w')
|
|
@@ -92,10 +102,23 @@ program
|
|
|
92
102
|
program
|
|
93
103
|
.command('fonts')
|
|
94
104
|
.alias('f')
|
|
95
|
-
.description(
|
|
96
|
-
.help(`Copy Font Awesome (Brands, Regular, Solid), Material Icons, Material Symbols or Framework 7 icons,\
|
|
105
|
+
.description(`<deprecated> Will be removed in the next major release. Use ${chalk.yellow('copy-fonts')} instead!`)
|
|
106
|
+
.help(`Copy Font Awesome (Brands, Regular, Solid), Material Icons, Material Symbols or Framework 7 icons,\nto your project's ${chalk.yellow('app/assets/fonts/')} folder and their names fixed to work on iOS and Android`)
|
|
107
|
+
.option('-v, --vendor <arguments>', `Use any of the following arguments to copy specific font vendors:\n ${chalk.yellow('fa')} = Font Awesome Icons\n ${chalk.yellow('mi')} = Material Icons\n ${chalk.yellow('ms')} = Material Symbols\n ${chalk.yellow('f7')} = Framework7 Icons`)
|
|
108
|
+
.option('-m, --module', `Use the --module option to also copy the corresponding CommonJS module in ${chalk.yellow('./app/lib/')} folder`)
|
|
109
|
+
.option('-s, --styles', `Copy the corresponding .tss file into ${chalk.yellow('./purgetss/styles/')} folder`)
|
|
110
|
+
.action((args, options, logger) => {
|
|
111
|
+
purgetss.copyFonts(options);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
program
|
|
115
|
+
.command('copy-fonts')
|
|
116
|
+
.alias('cf')
|
|
117
|
+
.description('Copy default icon font libraries to your project')
|
|
118
|
+
.help(`Copy Font Awesome (Brands, Regular, Solid), Material Icons, Material Symbols or Framework 7 icons,\nto your project's ${chalk.yellow('app/assets/fonts/')} folder and their names fixed to work on iOS and Android`)
|
|
97
119
|
.option('-v, --vendor <arguments>', `Use any of the following arguments to copy specific font vendors:\n ${chalk.yellow('fa')} = Font Awesome Icons\n ${chalk.yellow('mi')} = Material Icons\n ${chalk.yellow('ms')} = Material Symbols\n ${chalk.yellow('f7')} = Framework7 Icons`)
|
|
98
|
-
.option('-m, --
|
|
120
|
+
.option('-m, --module', `Use the --module option to also copy the corresponding CommonJS module in ${chalk.yellow('./app/lib/')} folder`)
|
|
121
|
+
.option('-s, --styles', `Copy the corresponding .tss file into ${chalk.yellow('./purgetss/styles/')} folder`)
|
|
99
122
|
.action((args, options, logger) => {
|
|
100
123
|
purgetss.copyFonts(options);
|
|
101
124
|
});
|
|
@@ -105,7 +128,7 @@ program
|
|
|
105
128
|
.alias('bf')
|
|
106
129
|
.description(`Builds a ${chalk.yellow('fonts.tss')} file from fonts and styles in ${chalk.yellow('./purgetss/fonts')}`)
|
|
107
130
|
.help(`It will generate a new ${chalk.yellow('fonts.tss')} file based on the fonts and css files located in ${chalk.yellow('./purgetss/fonts')} folder`)
|
|
108
|
-
.option('-m, --
|
|
131
|
+
.option('-m, --module', `Use the --module option to also generate a CommonJS module in ${chalk.yellow('./app/lib/')} folder called ${chalk.yellow('purgetss-fonts.js')}`)
|
|
109
132
|
.action((args, options, logger) => {
|
|
110
133
|
purgetss.buildFonts(options);
|
|
111
134
|
});
|
|
@@ -113,7 +136,7 @@ program
|
|
|
113
136
|
program
|
|
114
137
|
.command('module')
|
|
115
138
|
.alias('m')
|
|
116
|
-
.description(`
|
|
139
|
+
.description(`Copy ${chalk.yellow('purgetss.ui.js')} module to your project's ${chalk.yellow('lib')} folder`)
|
|
117
140
|
.help('This file contains the Animation module\n')
|
|
118
141
|
.action((args, options, logger) => {
|
|
119
142
|
purgetss.copyModulesLibrary();
|
package/dist/tailwind.tss
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Based on Tailwind CSS v3.2.
|
|
1
|
+
// Based on Tailwind CSS v3.2.1: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
|
|
2
2
|
// Created by Adam Wathan ( https://twitter.com/adamwathan ).
|
|
3
3
|
|
|
4
4
|
// Tailwind-like styles
|
|
@@ -31,7 +31,6 @@ const tiCompletionsFile = require('../lib/completions/titanium/completions-v3.js
|
|
|
31
31
|
const srcConfigFile = path.resolve(__dirname, '../lib/templates/purgetss.config.js');
|
|
32
32
|
|
|
33
33
|
const configFile = (fs.existsSync(projectsConfigJS)) ? require(projectsConfigJS) : require(srcConfigFile);
|
|
34
|
-
configFile.plugins = configFile.plugins ?? [];
|
|
35
34
|
configFile.purge = configFile.purge ?? { mode: 'all' };
|
|
36
35
|
configFile.theme.extend = configFile.theme.extend ?? {};
|
|
37
36
|
configFile.fonts = configFile.fonts ?? { mode: 'fileName' };
|
|
@@ -39,7 +38,8 @@ configFile.fonts = configFile.fonts ?? { mode: 'fileName' };
|
|
|
39
38
|
const configOptions = (configFile.purge && configFile.purge.options) ? configFile.purge.options : false;
|
|
40
39
|
if (configOptions) {
|
|
41
40
|
configOptions.widgets = configOptions.widgets ?? false;
|
|
42
|
-
configOptions.missing = configOptions.missing ??
|
|
41
|
+
configOptions.missing = configOptions.missing ?? true;
|
|
42
|
+
configOptions.plugins = configOptions.plugins ?? [];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function autoBuildTailwindTSS(options = {}) {
|
|
@@ -60,8 +60,9 @@ function autoBuildTailwindTSS(options = {}) {
|
|
|
60
60
|
tailwindStyles = helpers.compileApplyDirectives(tailwindStyles);
|
|
61
61
|
|
|
62
62
|
if (fs.existsSync(projectsConfigJS)) {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
makeSureFolderExists(cwd + '/purgetss/styles/');
|
|
64
|
+
saveFile(cwd + '/purgetss/styles/tailwind.tss', tailwindStyles);
|
|
65
|
+
logger.file('./purgetss/styles/tailwind.tss');
|
|
65
66
|
// if (saveGlossary) {
|
|
66
67
|
// saveFile(cwd + '/purgetss/experimental/baseValues.json', JSON.stringify(baseValues, null, 2));
|
|
67
68
|
// saveFile(cwd + '/purgetss/experimental/tiUIComponents.json', JSON.stringify(tiUIComponents, null, 2));
|
|
@@ -413,7 +414,7 @@ function combineDefaultThemeWithConfigFile() {
|
|
|
413
414
|
: _.merge({ default: { width: 'Ti.UI.SIZE', height: 'Ti.UI.SIZE' } }, configFile.theme.View);
|
|
414
415
|
|
|
415
416
|
// !Delete plugins specified in the config file
|
|
416
|
-
let deletePlugins =
|
|
417
|
+
let deletePlugins = checkDeletePlugins();
|
|
417
418
|
_.each(deletePlugins, value => {
|
|
418
419
|
delete base[value];
|
|
419
420
|
delete configFile.theme[value];
|
|
@@ -423,6 +424,11 @@ function combineDefaultThemeWithConfigFile() {
|
|
|
423
424
|
return base;
|
|
424
425
|
}
|
|
425
426
|
|
|
427
|
+
function checkDeletePlugins() {
|
|
428
|
+
let deletePlugins = configFile.plugins ?? configOptions.plugins;
|
|
429
|
+
return Array.isArray(deletePlugins) ? deletePlugins : Object.keys(deletePlugins).map(key => key);
|
|
430
|
+
}
|
|
431
|
+
|
|
426
432
|
//! Helper Functions
|
|
427
433
|
function removeDeprecatedColors(theObject) {
|
|
428
434
|
delete theObject.blueGray;
|
package/index.js
CHANGED
|
@@ -42,9 +42,10 @@ const projectsFontAwesomeJS = cwd + '/app/lib/fontawesome.js';
|
|
|
42
42
|
|
|
43
43
|
const projectsPurgeTSSFolder = cwd + '/purgetss';
|
|
44
44
|
const projectsConfigJS = cwd + '/purgetss/config.js';
|
|
45
|
-
const projectsTailwind_TSS = cwd + '/purgetss/tailwind.tss';
|
|
45
|
+
const projectsTailwind_TSS = cwd + '/purgetss/styles/tailwind.tss';
|
|
46
46
|
const projectsPurge_TSS_Fonts_Folder = cwd + '/purgetss/fonts';
|
|
47
|
-
const
|
|
47
|
+
const projectsPurge_TSS_Styles_Folder = cwd + '/purgetss/styles';
|
|
48
|
+
const projectsFA_TSS_File = cwd + '/purgetss/styles/fontawesome.tss';
|
|
48
49
|
|
|
49
50
|
// js icon modules
|
|
50
51
|
const srcLibFA = path.resolve(__dirname, './dist/fontawesome.js');
|
|
@@ -99,7 +100,6 @@ const srcMaterialSymbolsTSSFile = path.resolve(__dirname, './dist/materialsymbol
|
|
|
99
100
|
const srcConfigFile = path.resolve(__dirname, './lib/templates/purgetss.config.js');
|
|
100
101
|
|
|
101
102
|
const configFile = (fs.existsSync(projectsConfigJS)) ? require(projectsConfigJS) : require(srcConfigFile);
|
|
102
|
-
configFile.plugins = configFile.plugins ?? {};
|
|
103
103
|
configFile.purge = configFile.purge ?? { mode: 'all' };
|
|
104
104
|
configFile.theme.extend = configFile.theme.extend ?? {};
|
|
105
105
|
configFile.fonts = configFile.fonts ?? { mode: 'fileName' };
|
|
@@ -109,6 +109,7 @@ if (configOptions) {
|
|
|
109
109
|
configOptions.legacy = configOptions.legacy ?? false;
|
|
110
110
|
configOptions.widgets = configOptions.widgets ?? false;
|
|
111
111
|
configOptions.missing = configOptions.missing ?? true;
|
|
112
|
+
configOptions.plugins = configOptions.plugins ?? [];
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
const srcJMKFile = path.resolve(__dirname, './lib/templates/alloy.jmk');
|
|
@@ -166,7 +167,7 @@ function init(options) {
|
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
// definitios file
|
|
169
|
-
if (!fs.existsSync(cwd + '/purgetss/definitions.css') || options.all) {
|
|
170
|
+
if (!fs.existsSync(cwd + '/purgetss/styles/definitions.css') || options.all) {
|
|
170
171
|
createDefinitionsFile();
|
|
171
172
|
}
|
|
172
173
|
|
|
@@ -230,10 +231,12 @@ function copyFonts(options) {
|
|
|
230
231
|
|
|
231
232
|
if (options.vendor && typeof options.vendor === 'string') {
|
|
232
233
|
let selected = _.uniq(options.vendor.replace(/ /g, '').split(','));
|
|
234
|
+
logger.info('Copying Fonts...');
|
|
233
235
|
_.each(selected, vendor => {
|
|
234
236
|
copyFont(vendor);
|
|
235
237
|
});
|
|
236
238
|
} else {
|
|
239
|
+
logger.info('Copying Fonts to', chalk.yellow('./app/assets/fonts'), 'folder');
|
|
237
240
|
copyFont('fa');
|
|
238
241
|
copyFont('mi');
|
|
239
242
|
copyFont('ms');
|
|
@@ -241,8 +244,16 @@ function copyFonts(options) {
|
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
if (options.modules) {
|
|
247
|
+
console.log();
|
|
248
|
+
logger.info('Copying Modules to', chalk.yellow('./app/lib'), 'folder');
|
|
244
249
|
copyFontLibraries(options);
|
|
245
250
|
}
|
|
251
|
+
|
|
252
|
+
if (options.styles) {
|
|
253
|
+
console.log();
|
|
254
|
+
logger.info('Copying Styles to', chalk.yellow('./purgetss/styles'), 'folder');
|
|
255
|
+
copyFontStyles(options);
|
|
256
|
+
}
|
|
246
257
|
}
|
|
247
258
|
}
|
|
248
259
|
module.exports.copyFonts = copyFonts;
|
|
@@ -260,11 +271,33 @@ function copyFontLibraries(options) {
|
|
|
260
271
|
} else {
|
|
261
272
|
copyFontLibrary('fa');
|
|
262
273
|
copyFontLibrary('mi');
|
|
274
|
+
copyFontLibrary('ms');
|
|
263
275
|
copyFontLibrary('f7');
|
|
264
276
|
}
|
|
265
277
|
}
|
|
266
278
|
}
|
|
267
279
|
|
|
280
|
+
//! Command: copy-font-liraries
|
|
281
|
+
function copyFontStyles(options) {
|
|
282
|
+
if (alloyProject()) {
|
|
283
|
+
makeSureFolderExists(projectsPurgeTSSFolder);
|
|
284
|
+
|
|
285
|
+
makeSureFolderExists(projectsPurge_TSS_Styles_Folder);
|
|
286
|
+
|
|
287
|
+
if (options.vendor && typeof options.vendor === 'string') {
|
|
288
|
+
let selected = _.uniq(options.vendor.replace(/ /g, '').split(','));
|
|
289
|
+
_.each(selected, vendor => {
|
|
290
|
+
copyFontStyle(vendor);
|
|
291
|
+
});
|
|
292
|
+
} else {
|
|
293
|
+
copyFontStyle('fa');
|
|
294
|
+
copyFontStyle('mi');
|
|
295
|
+
copyFontStyle('ms');
|
|
296
|
+
copyFontStyle('f7');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
268
301
|
function copyModulesLibrary() {
|
|
269
302
|
if (alloyProject()) {
|
|
270
303
|
makeSureFolderExists(projectsLibFolder);
|
|
@@ -377,8 +410,10 @@ function shades(args, options) {
|
|
|
377
410
|
|
|
378
411
|
let colorFamily = (options.random || !args.hexcode) ? generateColorShades(chroma.random(), referenceColorFamilies) : generateColorShades(args.hexcode, referenceColorFamilies);
|
|
379
412
|
|
|
380
|
-
if (args.name) colorFamily.name = args.name
|
|
381
|
-
|
|
413
|
+
if (args.name) colorFamily.name = args.name
|
|
414
|
+
else if (options.name) colorFamily.name = options.name;
|
|
415
|
+
|
|
416
|
+
colorFamily.name = colorFamily.name.replace(/'/g, '').replace(/\//g, '').replace(/\s+/g, ' ');
|
|
382
417
|
|
|
383
418
|
let colorObject = createColorObject(colorFamily, colorFamily.hexcode, options);
|
|
384
419
|
|
|
@@ -387,6 +422,10 @@ function shades(args, options) {
|
|
|
387
422
|
configFile['theme']['extend']['colors'][colorObject.name] = colorObject.shades;
|
|
388
423
|
fs.writeFileSync(projectsConfigJS, 'module.exports = ' + cleanDoubleQuotes(configFile, options), 'utf8', err => { throw err; });
|
|
389
424
|
logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(`${colorFamily.hexcode}`)}) saved in`, chalk.yellow('config.js'));
|
|
425
|
+
|
|
426
|
+
if (options.module) {
|
|
427
|
+
colorModule();
|
|
428
|
+
}
|
|
390
429
|
} else if (options.json) {
|
|
391
430
|
logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(`${colorFamily.hexcode}`)})\n${JSON.stringify(colorObject, null, 2)}`);
|
|
392
431
|
} else {
|
|
@@ -395,6 +434,16 @@ function shades(args, options) {
|
|
|
395
434
|
}
|
|
396
435
|
exports.shades = shades;
|
|
397
436
|
|
|
437
|
+
function colorModule() {
|
|
438
|
+
// read config.js
|
|
439
|
+
let configFile = require(projectsConfigJS);
|
|
440
|
+
makeSureFolderExists(projectsLibFolder);
|
|
441
|
+
let mainColors = { ...configFile.theme.colors, ...configFile.theme.extend.colors };
|
|
442
|
+
fs.writeFileSync(`${projectsLibFolder}/purgetss.colors.js`, 'exports.colors = ' + cleanDoubleQuotes(mainColors, {}), 'utf8', err => { throw err; });
|
|
443
|
+
logger.info(`All colors copied to ${chalk.yellow('lib/purgetss.colors.js')} module`);
|
|
444
|
+
}
|
|
445
|
+
exports.colorModule = colorModule;
|
|
446
|
+
|
|
398
447
|
function cleanDoubleQuotes(configFile, options) {
|
|
399
448
|
const regexUnicode = /[^\u0000-\u00FF]/g;
|
|
400
449
|
|
|
@@ -403,6 +452,8 @@ function cleanDoubleQuotes(configFile, options) {
|
|
|
403
452
|
let util = require('util');
|
|
404
453
|
let inspected = util.inspect(configFile, false, 10);
|
|
405
454
|
|
|
455
|
+
if (inspected === 'undefined') return '{}';
|
|
456
|
+
|
|
406
457
|
return inspected.replace(regexUnicode, match => `\\u${match.charCodeAt(0).toString(16)}`);
|
|
407
458
|
}
|
|
408
459
|
|
|
@@ -580,15 +631,17 @@ function buildFonts(options) {
|
|
|
580
631
|
|
|
581
632
|
if (files.length > 0) {
|
|
582
633
|
makeSureFolderExists(projectsPurgeTSSFolder);
|
|
634
|
+
makeSureFolderExists(projectsPurge_TSS_Styles_Folder);
|
|
583
635
|
|
|
584
|
-
fs.writeFileSync(cwd + '/purgetss/fonts.tss', tssClasses, err => {
|
|
636
|
+
fs.writeFileSync(cwd + '/purgetss/styles/fonts.tss', tssClasses, err => {
|
|
585
637
|
throw err;
|
|
586
638
|
});
|
|
587
639
|
|
|
588
|
-
makeSureFolderExists(projectsLibFolder);
|
|
589
640
|
}
|
|
590
641
|
|
|
591
642
|
if (fontJS) {
|
|
643
|
+
makeSureFolderExists(projectsLibFolder);
|
|
644
|
+
|
|
592
645
|
let exportIcons = 'const icons = {';
|
|
593
646
|
exportIcons += fontJS.slice(0, -1);
|
|
594
647
|
exportIcons += '\n};\n';
|
|
@@ -601,14 +654,14 @@ function buildFonts(options) {
|
|
|
601
654
|
|
|
602
655
|
exportIcons += '\n// Helper Functions\n' + fs.readFileSync(path.resolve(__dirname, './lib/templates/icon-functions.js'), 'utf8');
|
|
603
656
|
|
|
604
|
-
fs.writeFileSync(projectsLibFolder
|
|
657
|
+
fs.writeFileSync(`${projectsLibFolder}/purgetss.fonts.js'`, exportIcons, err => {
|
|
605
658
|
throw err;
|
|
606
659
|
});
|
|
607
660
|
|
|
608
661
|
logger.info(`${chalk.yellow('./app/lib/purgetss.fonts.js')} file created!`);
|
|
609
662
|
} else {
|
|
610
|
-
if (fs.existsSync(projectsLibFolder
|
|
611
|
-
fs.unlinkSync(projectsLibFolder
|
|
663
|
+
if (fs.existsSync(`${projectsLibFolder}/purgetss.fonts.js'`)) {
|
|
664
|
+
fs.unlinkSync(`${projectsLibFolder}/purgetss.fonts.js'`);
|
|
612
665
|
}
|
|
613
666
|
}
|
|
614
667
|
|
|
@@ -735,13 +788,13 @@ function copyFreeFonts() {
|
|
|
735
788
|
fs.copyFile(srcFonts_Folder + '/FontAwesome6Free-Regular.ttf', projectsFontsFolder + '/FontAwesome6Free-Regular.ttf', callback);
|
|
736
789
|
fs.copyFile(srcFonts_Folder + '/FontAwesome6Free-Solid.ttf', projectsFontsFolder + '/FontAwesome6Free-Solid.ttf', callback);
|
|
737
790
|
|
|
738
|
-
logger.
|
|
791
|
+
logger.warn(' - Font Awesome Free');
|
|
739
792
|
}
|
|
740
793
|
|
|
741
794
|
function copyProFonts(fontFamilies, webFonts) {
|
|
742
795
|
_.each(fontFamilies, (dest, src) => {
|
|
743
796
|
if (copyFile(`${webFonts}/${src}`, dest)) {
|
|
744
|
-
logger.
|
|
797
|
+
logger.warn(` - ${dest} Font copied to`, chalk.yellow('./app/assets/fonts'), 'folder');
|
|
745
798
|
}
|
|
746
799
|
});
|
|
747
800
|
}
|
|
@@ -760,7 +813,7 @@ function copyMaterialIconsFonts() {
|
|
|
760
813
|
copyFile(`${srcFonts_Folder}/${familyName}`, familyName);
|
|
761
814
|
});
|
|
762
815
|
|
|
763
|
-
logger.
|
|
816
|
+
logger.warn(' - Material Icons');
|
|
764
817
|
}
|
|
765
818
|
|
|
766
819
|
function copyMaterialSymbolsFonts() {
|
|
@@ -775,13 +828,13 @@ function copyMaterialSymbolsFonts() {
|
|
|
775
828
|
copyFile(`${srcFonts_Folder}/${familyName}`, familyName);
|
|
776
829
|
});
|
|
777
830
|
|
|
778
|
-
logger.
|
|
831
|
+
logger.warn(' - Material Symbols');
|
|
779
832
|
}
|
|
780
833
|
|
|
781
834
|
function copyFramework7IconsFonts() {
|
|
782
835
|
// Framework7 Font
|
|
783
836
|
copyFile(srcFonts_Folder + '/Framework7-Icons.ttf', 'Framework7-Icons.ttf');
|
|
784
|
-
logger.
|
|
837
|
+
logger.warn(' - Framework 7');
|
|
785
838
|
}
|
|
786
839
|
|
|
787
840
|
function processFontsCSS(data) {
|
|
@@ -939,14 +992,14 @@ function findPrefix(rules) {
|
|
|
939
992
|
return `${firstPrefix}-${secondPrefix}`;
|
|
940
993
|
} else if (firstCounter == 1) {
|
|
941
994
|
return `${firstPrefix}`;
|
|
942
|
-
}
|
|
995
|
+
}
|
|
943
996
|
}
|
|
944
997
|
|
|
945
998
|
//! Purge Fonts
|
|
946
999
|
function purgeFonts(uniqueClasses, cleanUniqueClasses) {
|
|
947
|
-
if (fs.existsSync(cwd + '/purgetss/fonts.tss')) {
|
|
1000
|
+
if (fs.existsSync(cwd + '/purgetss/styles/fonts.tss')) {
|
|
948
1001
|
let purgedClasses = '\n// Font Styles\n';
|
|
949
|
-
purgedClasses += purgeFontIcons(cwd + '/purgetss/fonts.tss', uniqueClasses, 'Purging Font styles...', cleanUniqueClasses, []);
|
|
1002
|
+
purgedClasses += purgeFontIcons(cwd + '/purgetss/styles/fonts.tss', uniqueClasses, 'Purging Font styles...', cleanUniqueClasses, []);
|
|
950
1003
|
return (purgedClasses === '\n// Font Styles\n') ? '' : purgedClasses;
|
|
951
1004
|
}
|
|
952
1005
|
|
|
@@ -969,7 +1022,7 @@ function prettifyFontName(str, prefix) {
|
|
|
969
1022
|
|
|
970
1023
|
let pretty = withoutPrefix.join('').replace(':', '');
|
|
971
1024
|
return pretty.replace(/^.{1}/g, pretty[0].toLowerCase());
|
|
972
|
-
}
|
|
1025
|
+
}
|
|
973
1026
|
|
|
974
1027
|
//! Helper Functions
|
|
975
1028
|
function findMissingClasses(tempPurged) {
|
|
@@ -1595,7 +1648,7 @@ function combineAllValues(base, defaultTheme) {
|
|
|
1595
1648
|
}
|
|
1596
1649
|
|
|
1597
1650
|
// !Delete plugins specified in the config file
|
|
1598
|
-
let deletePlugins =
|
|
1651
|
+
let deletePlugins = checkDeletePlugins();
|
|
1599
1652
|
_.each(deletePlugins, value => {
|
|
1600
1653
|
delete allValues[value];
|
|
1601
1654
|
delete configFile.theme[value];
|
|
@@ -1609,6 +1662,11 @@ function combineAllValues(base, defaultTheme) {
|
|
|
1609
1662
|
return allValues;
|
|
1610
1663
|
}
|
|
1611
1664
|
|
|
1665
|
+
function checkDeletePlugins() {
|
|
1666
|
+
let deletePlugins = configFile.plugins ?? configOptions.plugins;
|
|
1667
|
+
return Array.isArray(deletePlugins) ? deletePlugins : Object.keys(deletePlugins).map(key => key);
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1612
1670
|
//! Build Tailwind ( AUTO )
|
|
1613
1671
|
function buildTailwind(options) {
|
|
1614
1672
|
helpers.globalOptions.legacy = configOptions.legacy;
|
|
@@ -1666,8 +1724,9 @@ function buildTailwindLegacy() {
|
|
|
1666
1724
|
let finalTailwindStyles = helpers.compileApplyDirectives(tailwindStyles);
|
|
1667
1725
|
|
|
1668
1726
|
if (fs.existsSync(projectsConfigJS)) {
|
|
1727
|
+
makeSureFolderExists(projectsPurge_TSS_Styles_Folder);
|
|
1669
1728
|
fs.writeFileSync(projectsTailwind_TSS, finalTailwindStyles);
|
|
1670
|
-
logger.file('./purgetss/tailwind.tss', '( Legacy )');
|
|
1729
|
+
logger.file('./purgetss/styles/tailwind.tss', '( Legacy )');
|
|
1671
1730
|
} else {
|
|
1672
1731
|
fs.writeFileSync(srcTailwindTSS, finalTailwindStyles);
|
|
1673
1732
|
logger.file('./dist/tailwind.tss', '( Legacy )');
|
|
@@ -1738,8 +1797,8 @@ function createDefinitionsFile() {
|
|
|
1738
1797
|
});
|
|
1739
1798
|
}
|
|
1740
1799
|
|
|
1741
|
-
if (fs.existsSync(cwd + '/purgetss/fonts.tss')) {
|
|
1742
|
-
classDefinitions += fs.readFileSync(cwd + '/purgetss/fonts.tss', 'utf8');
|
|
1800
|
+
if (fs.existsSync(cwd + '/purgetss/styles/fonts.tss')) {
|
|
1801
|
+
classDefinitions += fs.readFileSync(cwd + '/purgetss/styles/fonts.tss', 'utf8');
|
|
1743
1802
|
}
|
|
1744
1803
|
|
|
1745
1804
|
classDefinitions += (fs.existsSync(projectsFA_TSS_File)) ? fs.readFileSync(projectsFA_TSS_File, 'utf8') : fs.readFileSync(srcFontAwesomeTSSFile, 'utf8');
|
|
@@ -1762,9 +1821,9 @@ function createDefinitionsFile() {
|
|
|
1762
1821
|
|
|
1763
1822
|
classDefinitions += '.ios{}.android{}.handheld{}.tablet{}.open{}.close{}.complete{}.drag{}.drop{}.bounds{}';
|
|
1764
1823
|
|
|
1765
|
-
fs.writeFileSync(cwd + '/purgetss/definitions.css', `/* Class definitions (v6.x) */${classDefinitions}`);
|
|
1824
|
+
fs.writeFileSync(cwd + '/purgetss/styles/definitions.css', `/* Class definitions (v6.x) */${classDefinitions}`);
|
|
1766
1825
|
|
|
1767
|
-
logger.file('./purgetss/definitions.css');
|
|
1826
|
+
logger.file('./purgetss/styles/definitions.css');
|
|
1768
1827
|
}
|
|
1769
1828
|
|
|
1770
1829
|
//! Build tailwind's custom values
|
|
@@ -2146,7 +2205,7 @@ function encodeHTML(str) {
|
|
|
2146
2205
|
const code = {
|
|
2147
2206
|
'&': '&',
|
|
2148
2207
|
};
|
|
2149
|
-
return str.replace(
|
|
2208
|
+
return str.replace(/&/gm, i => code[i]);
|
|
2150
2209
|
}
|
|
2151
2210
|
|
|
2152
2211
|
function callback(err) {
|
|
@@ -2210,23 +2269,53 @@ function copyFontLibrary(vendor) {
|
|
|
2210
2269
|
buildFontAwesomeJS();
|
|
2211
2270
|
} else {
|
|
2212
2271
|
fs.copyFileSync(srcLibFA, projectsLibFolder + '/fontawesome.js');
|
|
2213
|
-
logger.
|
|
2272
|
+
logger.warn(' - fontawesome.js');
|
|
2214
2273
|
}
|
|
2215
2274
|
break;
|
|
2216
2275
|
case 'mi':
|
|
2217
2276
|
case 'materialicons':
|
|
2218
2277
|
fs.copyFileSync(srcLibMI, projectsLibFolder + '/materialicons.js');
|
|
2219
|
-
logger.
|
|
2278
|
+
logger.warn(' - materialicons.js');
|
|
2220
2279
|
break;
|
|
2221
2280
|
case 'ms':
|
|
2222
2281
|
case 'materialsymbol':
|
|
2223
2282
|
fs.copyFileSync(srcLibMS, projectsLibFolder + '/materialsymbols.js');
|
|
2224
|
-
logger.
|
|
2283
|
+
logger.warn(' - materialsymbols.js');
|
|
2225
2284
|
break;
|
|
2226
2285
|
case 'f7':
|
|
2227
2286
|
case 'framework7':
|
|
2228
2287
|
fs.copyFileSync(srcLibF7, projectsLibFolder + '/framework7icons.js');
|
|
2229
|
-
logger.
|
|
2288
|
+
logger.warn(' - framework7icons.js');
|
|
2289
|
+
break;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2293
|
+
//! Copy Font Styles
|
|
2294
|
+
function copyFontStyle(vendor) {
|
|
2295
|
+
switch (vendor) {
|
|
2296
|
+
case 'fa':
|
|
2297
|
+
case 'fontawesome':
|
|
2298
|
+
if (fs.existsSync(srcFA_Beta_CSSFile) || fs.existsSync(srcFA_Pro_CSS)) {
|
|
2299
|
+
buildFontAwesomeJS();
|
|
2300
|
+
} else {
|
|
2301
|
+
fs.copyFileSync(srcLibFA, projectsPurge_TSS_Styles_Folder + '/fontawesome.tss');
|
|
2302
|
+
logger.warn(' - fontawesome.tss');
|
|
2303
|
+
}
|
|
2304
|
+
break;
|
|
2305
|
+
case 'mi':
|
|
2306
|
+
case 'materialicons':
|
|
2307
|
+
fs.copyFileSync(srcLibMI, projectsPurge_TSS_Styles_Folder + '/materialicons.tss');
|
|
2308
|
+
logger.warn(' - materialicons.tss');
|
|
2309
|
+
break;
|
|
2310
|
+
case 'ms':
|
|
2311
|
+
case 'materialsymbol':
|
|
2312
|
+
fs.copyFileSync(srcLibMS, projectsPurge_TSS_Styles_Folder + '/materialsymbols.tss');
|
|
2313
|
+
logger.warn(' - materialsymbols.tss');
|
|
2314
|
+
break;
|
|
2315
|
+
case 'f7':
|
|
2316
|
+
case 'framework7':
|
|
2317
|
+
fs.copyFileSync(srcFramework7FontTSSFile, projectsPurge_TSS_Styles_Folder + '/framework7icons.tss');
|
|
2318
|
+
logger.warn(' - framework7icons.tss');
|
|
2230
2319
|
break;
|
|
2231
2320
|
}
|
|
2232
2321
|
}
|
|
@@ -2470,8 +2559,8 @@ function purgeFontAwesome(uniqueClasses, cleanUniqueClasses) {
|
|
|
2470
2559
|
let fontAwesome = false;
|
|
2471
2560
|
|
|
2472
2561
|
// check if fonts.tss exists and if it includes Font Awesome
|
|
2473
|
-
if (fs.existsSync(cwd + '/purgetss/fonts.tss')) {
|
|
2474
|
-
let fontsTSS = fs.readFileSync(cwd + '/purgetss/fonts.tss', 'utf8');
|
|
2562
|
+
if (fs.existsSync(cwd + '/purgetss/styles/fonts.tss')) {
|
|
2563
|
+
let fontsTSS = fs.readFileSync(cwd + '/purgetss/styles/fonts.tss', 'utf8');
|
|
2475
2564
|
fontAwesome = fontsTSS.includes('Font Awesome');
|
|
2476
2565
|
}
|
|
2477
2566
|
|
|
@@ -8,11 +8,11 @@ module.exports = {
|
|
|
8
8
|
legacy: false, // Generates & Purge tailwind.tss v5.x classes
|
|
9
9
|
missing: true, // Report missing classes
|
|
10
10
|
widgets: false, // Purge widgets too
|
|
11
|
-
safelist: [] // Array of classes to keep
|
|
11
|
+
safelist: [], // Array of classes to keep
|
|
12
|
+
plugins: [] // Array of properties to ignore
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
theme: {
|
|
15
16
|
extend: {}
|
|
16
|
-
}
|
|
17
|
-
plugins: []
|
|
17
|
+
}
|
|
18
18
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// Based on Tailwind CSS v3.2.
|
|
1
|
+
// Based on Tailwind CSS v3.2.1: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
|
|
2
2
|
// Created by Adam Wathan ( https://twitter.com/adamwathan ).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "purgetss",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.5",
|
|
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": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@fortawesome/fontawesome-free": "^6.2.0",
|
|
47
47
|
"caporal": "^1.4.0",
|
|
48
48
|
"chalk": "^4.1.2",
|
|
49
|
-
"chroma-js": "
|
|
49
|
+
"chroma-js": "2.1.2",
|
|
50
50
|
"command-exists": "^1.2.9",
|
|
51
|
-
"fontname": "^1.0.
|
|
51
|
+
"fontname": "^1.0.1",
|
|
52
52
|
"framework7-icons": "^5.0.5",
|
|
53
53
|
"glob": "^7.2.0",
|
|
54
54
|
"inquirer": "^8.2.4",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"path": "^0.12.7",
|
|
59
59
|
"prompts": "^2.4.2",
|
|
60
60
|
"read-css": "^0.3.0",
|
|
61
|
-
"tailwindcss": "^3.2.
|
|
61
|
+
"tailwindcss": "^3.2.1",
|
|
62
62
|
"traverse": "^0.6.7",
|
|
63
63
|
"update-notifier": "^5.1.0",
|
|
64
64
|
"uuid": "^9.0.0",
|