gulpfile.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var gulp = require('gulp');
  2. var gutil = require('gulp-util');
  3. var bower = require('bower');
  4. var concat = require('gulp-concat');
  5. var sass = require('gulp-sass');
  6. var minifyCss = require('gulp-minify-css');
  7. var rename = require('gulp-rename');
  8. var sh = require('shelljs');
  9. var paths = {
  10. sass: ['./scss/**/*.scss']
  11. };
  12. gulp.task('default', ['sass']);
  13. gulp.task('sass', function(done) {
  14. gulp.src('./scss/ionic.app.scss')
  15. .pipe(sass())
  16. .on('error', sass.logError)
  17. .pipe(gulp.dest('./www/css/'))
  18. .pipe(minifyCss({
  19. keepSpecialComments: 0
  20. }))
  21. .pipe(rename({ extname: '.min.css' }))
  22. .pipe(gulp.dest('./www/css/'))
  23. .on('end', done);
  24. });
  25. gulp.task('watch', ['sass'], function() {
  26. gulp.watch(paths.sass, ['sass']);
  27. });
  28. gulp.task('install', ['git-check'], function() {
  29. return bower.commands.install()
  30. .on('log', function(data) {
  31. gutil.log('bower', gutil.colors.cyan(data.id), data.message);
  32. });
  33. });
  34. gulp.task('git-check', function(done) {
  35. if (!sh.which('git')) {
  36. console.log(
  37. ' ' + gutil.colors.red('Git is not installed.'),
  38. '\n Git, the version control system, is required to download Ionic.',
  39. '\n Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',
  40. '\n Once git is installed, run \'' + gutil.colors.cyan('gulp install') + '\' again.'
  41. );
  42. process.exit(1);
  43. }
  44. done();
  45. });