Skip to content

Instantly share code, notes, and snippets.

@netsensei
Last active January 29, 2017 07:48
Show Gist options
  • Save netsensei/3c81c0399e5696b9de30 to your computer and use it in GitHub Desktop.
Save netsensei/3c81c0399e5696b9de30 to your computer and use it in GitHub Desktop.
Extends Ionics' default Gulp.js with a scripts & bower-files task. Moves app/ source outside the www folder.
var gulp = require('gulp');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var minifyCss = require('gulp-minify-css');
var rename = require('gulp-rename');
var gulpBowerFiles = require('gulp-bower-files');
var paths = {
sass: ['./scss/**/*.scss'],
scripts: ['./app/**/*.js', './app/*.js']
};
gulp.task("bower-files", function(){
gulpBowerFiles().pipe(gulp.dest("./www/lib"));
});
gulp.task('sass', function(done) {
gulp.src('./scss/ionic.app.scss')
.pipe(sass())
.pipe(gulp.dest('./www/css/'))
.pipe(minifyCss({
keepSpecialComments: 0
}))
.pipe(rename({ extname: '.min.css' }))
.pipe(gulp.dest('./www/css/'))
.on('end', done);
});
gulp.task('scripts', function(done) {
gulp.src(['./app/*.js', './app/**/*.js'])
.pipe(concat('app.js'))
.pipe(gulp.dest('./www/js'))
.on('end', done);
});
gulp.task('watch', function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.scripts, ['bower-files', 'scripts']);
});
gulp.task('default', ['sass']);
@jdnichollsc
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment