Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
139 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,147 @@ | ||
/******************************* | ||
Config | ||
*******************************/ | ||
|
||
/* | ||
All config options are defined inside build.config | ||
Please adjust this to your site's settings | ||
*/ | ||
|
||
var | ||
gulp = require('gulp'), | ||
concat = require('gulp-concat'), | ||
gutil = require('gulp-util'), | ||
notify = require('gulp-notify'), | ||
sass = require('gulp-less'), | ||
uglify = require('gulp-uglify'), | ||
watch = require('gulp-watch'), | ||
gulp = require('gulp'), | ||
|
||
// required components | ||
batch = require('gulp-batch'), | ||
concat = require('gulp-concat'), | ||
gutil = require('gulp-util'), | ||
notify = require('gulp-notify'), | ||
plumber = require('gulp-plumber'), | ||
sass = require('gulp-less'), | ||
uglify = require('gulp-uglify'), | ||
watch = require('gulp-watch') | ||
|
||
// read settings file | ||
config = require('build.config') | ||
; | ||
|
||
// update watched less file | ||
gulp.task('less', function () { | ||
gulp.src('./src/**/*.less') | ||
.pipe(less({ | ||
noCache: true, | ||
style: "expanded", | ||
lineNumbers: true, | ||
loadPath: './assets/styles/*' | ||
})) | ||
.pipe(gulp.dest('./assets/styles')) | ||
.pipe(notify({ | ||
message: "You just got super Sassy!" | ||
}));; | ||
}); | ||
|
||
// uglify task | ||
gulp.task('js', function() { | ||
// main app js file | ||
gulp.src('./assets/js/app.js') | ||
.pipe(uglify()) | ||
.pipe(concat("app.min.js")) | ||
.pipe(gulp.dest('./assets/js/')); | ||
|
||
// create 1 vendor.js file from all vendor plugin code | ||
gulp.src('./assets/js/vendor/**/*.js') | ||
.pipe(uglify()) | ||
.pipe(concat("vendor.js")) | ||
.pipe(gulp.dest('./assets/js')) | ||
.pipe( notify({ message: "Javascript is now ugly!"}) ); | ||
}); | ||
|
||
gulp.task('watch', function() { | ||
// watch scss files | ||
gulp.watch('./assets/styles/**/*.scss', function() { | ||
gulp.run('sass'); | ||
|
||
/******************************* | ||
Commands | ||
*******************************/ | ||
|
||
// Watches for changes to site and recompiles | ||
gulp.task('default', [ | ||
'watch site', | ||
'watch themes' | ||
]); | ||
|
||
// Rebuilds all files | ||
gulp.task('default', [ | ||
'build files' | ||
]); | ||
|
||
// Rebuilds all files | ||
gulp.task('clean', [ | ||
'clean output' | ||
]); | ||
|
||
|
||
/*-------------- | ||
Maintainer | ||
---------------*/ | ||
|
||
gulp.task('watch all', [ | ||
'watch site', | ||
'watch themes', | ||
'watch definitions', | ||
'watch module definitions' | ||
]); | ||
|
||
gulp.task('release', [ | ||
'build release' | ||
]); | ||
|
||
|
||
/******************************* | ||
Tasks | ||
*******************************/ | ||
|
||
/*-------------- | ||
User | ||
---------------*/ | ||
|
||
// recompile from site change | ||
gulp.task('site changed', function(files) { | ||
console.log('site changed', files); | ||
}); | ||
|
||
// recompile from packaged theme change | ||
gulp.task('theme changed', function(files) { | ||
console.log(files); | ||
}); | ||
|
||
// recompile less from definition change | ||
gulp.task('library definition changed', function(files) { | ||
console.log(files); | ||
|
||
// compile less | ||
|
||
// prefix css file | ||
|
||
// update concat file | ||
|
||
|
||
}); | ||
|
||
// clean output directory | ||
gulp.task('clean output', function(files) { | ||
console.log(files); | ||
|
||
}); | ||
|
||
|
||
/*-------------- | ||
Library | ||
---------------*/ | ||
|
||
/* These tasks are designed for updates to the core library */ | ||
|
||
// recompile from library changed | ||
gulp.task('library module changed', function () { | ||
// console.log("Warning: Edited Library File. I hope you know what you're doing") | ||
|
||
}); | ||
|
||
// Build release | ||
gulp.task('build release', function () { | ||
|
||
}); | ||
|
||
|
||
/*-------------- | ||
Watch | ||
---------------*/ | ||
|
||
gulp.task('watch site', function () { | ||
watch('src/_site/**/*(.overrides|.variables)', function (files, callback) { | ||
gulp.start('site files changed', callback); | ||
}); | ||
}); | ||
|
||
gulp.watch('./assets/js/**/*.js', function() { | ||
gulp.run('js'); | ||
gulp.task('watch themes', function () { | ||
watch('themes/**/*(.overrides|.variables)', function (files, callback) { | ||
gulp.start('theme files changed', callback); | ||
}); | ||
}); | ||
|
||
gulp.task('default', ['watch']); | ||
gulp.task('build', ['watch']); | ||
gulp.task('watch module definition', function () { | ||
watch('src/definitions/**/*.js', function (files, callback) { | ||
gulp.start('library module changed', callback); | ||
}); | ||
}); | ||
|
||
gulp.task('watch definitions', function () { | ||
watch('src/definitions/**/*.less', function (files, callback) { | ||
gulp.start('library definition changed', callback); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters