Browse Source

Setting up gulpfile

pull/1191/head
jlukic 10 years ago
parent
commit
6a1c85675f
2 changed files with 139 additions and 46 deletions
  1. 182
      gulpfile.js
  2. 3
      package.json

182
gulpfile.js

@ -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);
});
});

3
package.json

@ -35,11 +35,14 @@
"grunt-css": "x.x.x",
"grunt-karma": "x.x.x",
"grunt-karma-coveralls": "x.x.x",
"gulp": "^3.8.8",
"gulp-batch": "^1.0.1",
"gulp-concat": "^2.4.1",
"gulp-copy": "0.0.2",
"gulp-karma": "0.0.4",
"gulp-less": "^1.3.6",
"gulp-notify": "^2.0.0",
"gulp-plumber": "^0.6.6",
"gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1",
"gulp-watch": "^1.1.0",

Loading…
Cancel
Save