forked from conceptadev/rockets-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-css.js
More file actions
31 lines (25 loc) · 720 Bytes
/
copy-css.js
File metadata and controls
31 lines (25 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const fs = require('fs');
const path = require('path');
const glob = require('glob');
function createDirIfNotExist(dir) {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
}
function copyCSSFiles() {
// Glob pattern to match all .css files in src directories
const srcPattern = 'packages/*/src/**/*.css';
glob(srcPattern, (err, files) => {
if (err) {
console.error('Error reading CSS files:', err);
return;
}
files.forEach((file) => {
const distDir = file.replace('src', 'dist');
createDirIfNotExist(path.dirname(distDir));
fs.copyFileSync(file, distDir);
console.log(`Copied ${file} to ${distDir}`);
});
});
}
copyCSSFiles();