mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-15 02:36:36 +00:00
Basic authentication is done.(need refactor)
This commit is contained in:
57
Gulpfile.js
57
Gulpfile.js
@@ -5,29 +5,36 @@ var templateCache = require('gulp-angular-templatecache')
|
||||
var globby = require('globby')
|
||||
var template = require('gulp-template')
|
||||
var concat = require('gulp-concat')
|
||||
|
||||
var del = require('del')
|
||||
var runSequence = require('run-sequence')
|
||||
|
||||
var rev = require('gulp-rev')
|
||||
var merge = require('merge-stream')
|
||||
|
||||
var changed = require('gulp-changed')
|
||||
var cached = require('gulp-cached')
|
||||
var remember = require('gulp-remember')
|
||||
var livereload = require('gulp-livereload')
|
||||
var childProcess = require('child_process')
|
||||
|
||||
// for Dist
|
||||
var rev = require('gulp-rev')
|
||||
var ngAnnotate = require('gulp-ng-annotate')
|
||||
var uglify = require('gulp-uglify')
|
||||
var minifyCss = require('gulp-minify-css')
|
||||
|
||||
var livereload = require('gulp-livereload')
|
||||
|
||||
var config = require('./build.config.js')
|
||||
|
||||
gulp.task('js', function(){
|
||||
return gulp.src(['src/**/*.js']).pipe(gulp.dest('build'))
|
||||
return gulp.src(['src/**/*.js'])
|
||||
.pipe(changed('build'))
|
||||
.pipe(gulp.dest('build'))
|
||||
})
|
||||
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('src/**/*.scss')
|
||||
.pipe(sass({errLogToConsole: true}))
|
||||
.pipe(cached('styles'))
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(autoprefixer())
|
||||
.pipe(remember('styles'))
|
||||
.pipe(concat('all.css'))
|
||||
.pipe(gulp.dest('build'))
|
||||
.pipe(livereload())
|
||||
@@ -63,8 +70,25 @@ gulp.task('index', function () {
|
||||
.pipe(livereload())
|
||||
})
|
||||
|
||||
gulp.task('vendor', function () {
|
||||
var vendors = config.vendors
|
||||
|
||||
var vendorFiles = vendors.map(function (vendor) {
|
||||
return vendor.src
|
||||
})
|
||||
|
||||
return gulp.src(vendorFiles)
|
||||
.pipe(gulp.dest('build/vendor'))
|
||||
})
|
||||
|
||||
gulp.task('resources', function () {
|
||||
return gulp.src('resources/**/*')
|
||||
.pipe(changed('build/resources'))
|
||||
.pipe(gulp.dest('build/resources'))
|
||||
})
|
||||
|
||||
gulp.task('build', function (cb) {
|
||||
runSequence(['js', 'sass', 'tpls', 'vendor'], 'index', cb)
|
||||
runSequence(['js', 'sass', 'tpls', 'vendor', 'resources'], 'index', cb)
|
||||
})
|
||||
|
||||
gulp.task('watch', function (cb) {
|
||||
@@ -84,16 +108,13 @@ gulp.task('del', function (cb) {
|
||||
})
|
||||
|
||||
gulp.task('default', function (cb) {
|
||||
runSequence('del', 'build', 'watch', cb)
|
||||
})
|
||||
|
||||
gulp.task('vendor', function () {
|
||||
var vendors = config.vendors
|
||||
|
||||
vendorFiles = vendors.map(function (vendor) {
|
||||
return vendor.src
|
||||
var spawn = childProcess.spawn('http-server', ['build'])
|
||||
spawn.stdout.on('data', function (data) {
|
||||
console.log('OUT: ' + data)
|
||||
})
|
||||
spawn.stderr.on('data', function (data) {
|
||||
console.log('ERR: ' + data)
|
||||
})
|
||||
|
||||
return gulp.src(vendorFiles)
|
||||
.pipe(gulp.dest('build/vendor'))
|
||||
runSequence('del', 'build', 'watch', cb)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user