X-Git-Url: https://pwan.org/git/?p=tech-radar.git;a=blobdiff_plain;f=gulpfile.js;h=8a0ca3a00759ca9cb0bb8bf97e1d051e8f901287;hp=d5b7c25d54edd02dd34ba39f18883e6e4a1451ae;hb=297b3da3fee0bad006fef4763e5354898476ee58;hpb=39e4c825ef452111149e52862f5ea32a00789a46 diff --git a/gulpfile.js b/gulpfile.js index d5b7c25..8a0ca3a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,15 +1,60 @@ var gulp = require('gulp') + , pkg = require('./package.json') , gutil = require('gulp-util') , gkarma = require('gulp-karma') + , sass = require('gulp-sass') + , concat = require('gulp-concat') + , uglify = require('gulp-uglify') + , clean = require('gulp-clean') + , header = require('gulp-header') , files; + +banner = [ + '/**', + ' * <%= pkg.name %> + ' * @version v<%= pkg.version %>', + ' */', + '' +].join('\n'); + files = { LIB: 'bower_components/d3/*.min.js', NS: 'src/namespaces.js', SOURCE: 'src/**/*.js', - SPEC: 'test/**/*-spec.js' + SPEC: 'test/**/*-spec.js', + STYLESHEETS: 'src/stylesheets/**/*.scss' }; +gulp.task('sass', function () { + gulp.src(files.STYLESHEETS) + .pipe(sass()) + .pipe(gulp.dest('./dist/')); +}); + +gulp.task('concat', function () { + gulp.src([files.NS, files.SOURCE]) + .pipe(concat('tech-radar.js')) + .pipe(header(banner, { pkg: pkg })) + .pipe(gulp.dest('./dist/')); +}); +var clean = require('gulp-clean'); + +gulp.task('clean', function() { + gulp.src('./dist/', {read: false}) + .pipe(clean({force: true})); +}); + +gulp.task('compress', function() { + gulp.src([files.NS, files.SOURCE]) + .pipe(concat('tech-radar.min.js')) + .pipe(uglify({outSourceMap: true})) + .pipe(header(banner, { pkg: pkg })) + .pipe(gulp.dest('./dist/')) +}); + +gulp.task('dist', ['clean', 'concat', 'compress', 'sass']); + gulp.task('test', function (){ var karma;