Skip to content

Instantly share code, notes, and snippets.

@fredyfx
Created December 26, 2018 06:44
Show Gist options
  • Save fredyfx/bd8c27acc476c63c79ca683db0a51a34 to your computer and use it in GitHub Desktop.
Save fredyfx/bd8c27acc476c63c79ca683db0a51a34 to your computer and use it in GitHub Desktop.
archivo de configuración de gulpfile.js
/// <binding Clean='clean, minify, scripts' />
/*
This file in the main entry point for defining Gulp tasks and using Gulp plugins.
Click here to learn more. http://go.microsoft.com/fwlink/?LinkId=518007
*/
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var rimraf = require("rimraf");
var merge = require('merge-stream');
gulp.task("minify", function() {
var streams = [
gulp.src(["wwwroot/scripts/*.js"])
.pipe(uglify())
.pipe(concat("fredyfx.min.js"))
.pipe(gulp.dest("wwwroot/lib/site"))
];
return merge(streams);
});
// Directorios de Dependencias
var dependencias = {
"vue": {
"dist/*": ""
}
};
gulp.task("clean", function(cb) {
return rimraf("wwwroot/lib/", cb);
});
gulp.task("scripts", function() {
var streams = [];
for (var prop in dependencias) {
console.log("Preparando Scripts para: " + prop);
for (var itemProp in dependencias[prop]) {
streams.push(gulp.src("node_modules/" + prop + "/" + itemProp)
.pipe(gulp.dest("wwwroot/lib/" + prop + "/" + dependencias[prop][itemProp])));
}
}
return merge(streams);
});
gulp.task("default", gulp.series('clean', 'scripts', 'minify'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment