Last active
December 21, 2020 00:58
-
-
Save toddlucas/f7381ba648edb7070a279faca9b0b483 to your computer and use it in GitHub Desktop.
Minimal gulpfile to copy Bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <binding ProjectOpened='build' /> | |
"use strict"; | |
const gulp = require('gulp'), | |
merge = require('merge-stream'); | |
const roots = { | |
node_modules: "./node_modules/", | |
wwwroot: "./wwwroot/", | |
wwwlib: "./wwwroot/lib/" | |
}; | |
const paths = { | |
deps: { | |
"bootstrap": { | |
"dist/**/*": "dist" | |
}, | |
//"d3": { | |
// "dist/*": "" | |
//}, | |
"jquery": { | |
"dist/*": "dist" | |
}, | |
"jquery-validation": { | |
"dist/*": "dist" | |
}, | |
"jquery-validation-unobtrusive": { | |
"dist/*": "" | |
}, | |
//"font-awesome": { | |
// "css/*": "css", | |
// "fonts/*": "fonts" | |
//}, | |
"popper.js": { | |
"dist/umd/*": "" | |
} | |
} | |
}; | |
/** | |
* Copy only the files needed by the browser for wwwroot/lib from node_modules. | |
*/ | |
gulp.task("copy-lib", function () { | |
var streams = []; | |
// https://wildermuth.com/2017/11/19/ASP-NET-Core-2-0-and-the-End-of-Bower | |
for (var prop in paths.deps) { | |
for (var itemProp in paths.deps[prop]) { | |
streams.push(gulp.src(roots.node_modules + prop + "/" + itemProp) | |
.pipe(gulp.dest(roots.wwwlib + prop + "/" + paths.deps[prop][itemProp]))); | |
} | |
} | |
return merge(streams); | |
}); | |
/** | |
* Run tasks required for the build. | |
*/ | |
gulp.task('build', gulp.series('copy-lib')); | |
/** | |
* The default task invoked when gulp is run with no arguments. | |
*/ | |
gulp.task('default', function (done) { | |
done(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gulpfile-starter", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "PROPRIETARY", | |
"private": true, | |
"devDependencies": { | |
"gulp": "^4.0.2", | |
"merge-stream": "^2.0.0" | |
}, | |
"dependencies": { | |
"bootstrap": "^4.4.1", | |
"d3": "^5.15.0", | |
"font-awesome": "^4.7.0", | |
"jquery": "^3.4.1", | |
"jquery-validation": "^1.19.1", | |
"jquery-validation-unobtrusive": "^3.2.11", | |
"popper.js": "^1.16.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment