mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
clean prettier comments
This commit is contained in:
25
preview/.build/remove-prettier-ignore.mjs
Normal file
25
preview/.build/remove-prettier-ignore.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
// remove-prettier-ignore.js
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
import { sync } from 'glob';
|
||||
|
||||
const patterns = [
|
||||
/\/\/ prettier-ignore[\s]*/g,
|
||||
];
|
||||
|
||||
sync('dist/**/*.html').forEach(file => {
|
||||
let content = readFileSync(file, 'utf8');
|
||||
let modified = false;
|
||||
|
||||
patterns.forEach(pattern => {
|
||||
const newContent = content.replace(pattern, '');
|
||||
if (newContent !== content) {
|
||||
content = newContent;
|
||||
modified = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (modified) {
|
||||
writeFileSync(file, content);
|
||||
console.log(`Cleaned: ${file}`);
|
||||
}
|
||||
});
|
||||
@@ -18,9 +18,10 @@
|
||||
"js-minify": "pnpm run js-minify-demo",
|
||||
"js-minify-demo": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/preview/js/demo.js.map,includeSources,url=demo.min.js.map\" --output dist/preview/js/demo.min.js dist/preview/js/demo.js",
|
||||
"clean": "shx rm -rf dist demo",
|
||||
"html": "pnpm run html-build && pnpm run html-prettify",
|
||||
"html": "pnpm run html-build && pnpm run html-prettify && pnpm run html-remove-prettier-ignore",
|
||||
"html-build": "eleventy",
|
||||
"html-prettify": "prettier --write \"dist/**/*.html\" \"!dist/dist/**\"",
|
||||
"html-remove-prettier-ignore": "node .build/remove-prettier-ignore.mjs",
|
||||
"svg-optimize": "svgo -f svg/brand --pretty",
|
||||
"unused-files": "node .build/unused-files.mjs",
|
||||
"download-images": "node .build/download-images.mjs",
|
||||
|
||||
Reference in New Issue
Block a user