I'd like to create my initial structure folders in web project using gulp, Are there is any package that help me to make this task ?
Example:
-css
-img
--content
--icons
-fonts
-js
with one command in bash create that strcuture
Gulp can create structure folders without any package with this trick:
gulp.task('directories', function () {
return gulp.src('*.*', {read: false})
.pipe(gulp.dest('./css'))
.pipe(gulp.dest('./img'))
.pipe(gulp.dest('./img/content'))
.pipe(gulp.dest('./img/icons'))
.pipe(gulp.dest('./fonts'))
.pipe(gulp.dest('./js'));
});
You can use fs (Node.js - File System)
const gulp = require('gulp');
const fs = require('fs');
gulp.task('default', () => {
const folders = [
'css',
'img',
'img/content',
'img/icons',
'fonts',
'js'
];
folders.forEach(dir => {
if(!fs.existsSync(dir)) {
fs.mkdirSync(dir);
console.log('📁 folder created:', dir);
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With