http://robertdunaway.github.io
Gulp code kata list
All code katas lists
006 Gulp - copy & src & dest
Duration
5 minutes
Brief
In this kata we will copy our source files to a destination.
For more information
BING/GOOGLE: “Gulp src dest”
Book:
Gulp - Quick guide to getting up and running today
Instructions
Get tutorial folder or the entire katas-Gulp repo.
Open the [before/*.sln]
file and execute the kata.
Feel free to execute this kata multiple times because repetition creates motor memory.
Github
- Before (start kata with this)
- After
Kata
Create a task to copy all files from the “src
” folder to the destination folder, “wwwroot
”.
We copy our files to wwwroot
because this is the default folder used by Asp.Net. Once the files are copied other tasks can operate against the files.
Keeping the source code and generated files apart make source control management cleaner and more obvious.
All that is required to copy files is gulp. No plugins need installed.
var gulp = require('gulp');
gulp.task('copy-to-wwwroot', function () {
return gulp.src(['src/**/*'])
.pipe(gulp.dest('wwwroot'));
});
The two commands, you’ll find in most files are:
gulp.src()
gulp.dest()
The result of executing the copy-to-wwwroot task is
Next
Take a few minutes and imagine more examples.
0 comments:
Post a Comment