Last active
September 8, 2015 20:45
-
-
Save corinna000/831cd15e19df8f8230f6 to your computer and use it in GitHub Desktop.
Essential Gulpfile.js for Angular module development
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
/** | |
* Generic Gulpfile for building small AngularJS modules. This does the *very minimum* | |
* amount of work to get a module to build. | |
* npm install --save-dev gulp gulp-concat gulp-ng-annotate gulp-uglify del | |
*/ | |
var gulp = require('gulp'); | |
var concat = require('gulp-concat'); | |
var annotate = require('gulp-ng-annotate'); | |
var uglify = require('gulp-uglify'); | |
var config = require('./package.json'); | |
var del = require('del'); | |
// configure for your source files | |
var src = ['./src/**/*.module.js', './src/**/*.js', '!./src/**/*.spec.js']; | |
// reads the name of the module distributable from package.json | |
var match = config.main.match(/(.*)[/](.*)/); | |
var path = match[1]; | |
var file = match[2]; | |
gulp.task('clean', function () { | |
return del(path); | |
}); | |
gulp.task('build', ['clean'], function () { | |
gulp | |
.src(src) | |
.pipe(concat(file)) | |
.pipe(annotate()) | |
.pipe(uglify()) | |
.pipe(gulp.dest(path)); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment