|
| 1 | +/* |
| 2 | + * The MIT License |
| 3 | + * |
| 4 | + * Copyright (c) 2015, Sebastian Sdorra |
| 5 | + * |
| 6 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | + * of this software and associated documentation files (the "Software"), to deal |
| 8 | + * in the Software without restriction, including without limitation the rights |
| 9 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | + * copies of the Software, and to permit persons to whom the Software is |
| 11 | + * furnished to do so, subject to the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be included in |
| 14 | + * all copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | + * SOFTWARE. |
| 23 | + */ |
| 24 | + |
| 25 | + |
| 26 | +var gulp = require('gulp'); |
| 27 | +var $ = require('gulp-load-plugins')(); |
| 28 | +var rimraf = require('rimraf'); |
| 29 | +var jsReporter = require('jshint-stylish'); |
| 30 | +var pkg = require('./package.json'); |
| 31 | + |
| 32 | +var templateOptions = { |
| 33 | + root: '{widgetsPath}/markdown/src', |
| 34 | + module: 'adf.widget.markdown' |
| 35 | +}; |
| 36 | + |
| 37 | +gulp.task('csslint', function(){ |
| 38 | + gulp.src('src/*.css') |
| 39 | + .pipe($.csslint()) |
| 40 | + .pipe($.csslint.reporter()); |
| 41 | +}); |
| 42 | + |
| 43 | +gulp.task('jslint', function(){ |
| 44 | + gulp.src('src/*.js') |
| 45 | + .pipe($.jshint()) |
| 46 | + .pipe($.jshint.reporter(jsReporter)); |
| 47 | +}); |
| 48 | + |
| 49 | +gulp.task('lint', ['csslint', 'jslint']); |
| 50 | + |
| 51 | +gulp.task('clean', function(cb){ |
| 52 | + rimraf('dist', cb); |
| 53 | +}); |
| 54 | + |
| 55 | +gulp.task('css', function(){ |
| 56 | + gulp.src('src/*.css') |
| 57 | + .pipe($.concat(pkg.name + '.min.css')) |
| 58 | + .pipe($.minifyCss()) |
| 59 | + .pipe(gulp.dest('dist/')); |
| 60 | +}); |
| 61 | + |
| 62 | +gulp.task('js', function() { |
| 63 | + gulp.src(['src/*.js', 'src/*.html']) |
| 64 | + .pipe($.if('*.html', $.minifyHtml())) |
| 65 | + .pipe($.if('*.html', $.angularTemplatecache(pkg.name + '.tpl.js', templateOptions))) |
| 66 | + .pipe($.ngAnnotate()) |
| 67 | + .pipe($.concat(pkg.name + '.min.js')) |
| 68 | + // https://github.com/olov/ng-annotate/issues/133 |
| 69 | + //.pipe($.uglify()) |
| 70 | + .pipe(gulp.dest('dist/')); |
| 71 | +}); |
| 72 | + |
| 73 | +gulp.task('default', ['css', 'js']); |
0 commit comments