witas-ka/gulpfile.js

26 lines
No EOL
1.1 KiB
JavaScript

// Load gulp and gulp-copy
var gulp = require('gulp');
var copy = require('gulp-copy');
// Define a task to copy all css and js files from the source directory
gulp.task('copy-assets', function() {
// Use a glob pattern to select all css and js files in the source directory and its subdirectories
return gulp.src([
'./node_modules/bootstrap/dist/**/*.+(css|js)',
'./node_modules/feather-icons/dist/**/*.+(css|js)',
'./node_modules/progress-tracker/src/styles/*.+(css|js)'
]) // Specify the base folder as src
.pipe(copy('./assets/', { // Copy the files to the assets folder
prefix: 3, // Remove the src folder from the path
rename: function(path) { // Rename the path
if (path.extname === '.css') { // If the file is a css file
path.dirname = 'css'; // Change the folder name to css
} else if (path.extname === '.js') { // If the file is a js file
path.dirname = 'js'; // Change the folder name to js
}
}
}));
});
// Define a default task that runs the copy-assets task
gulp.task('default', gulp.series('copy-assets'));