Gulp cleanup

This commit is contained in:
Oliver Davies 2016-05-28 08:35:14 +01:00
parent 6dabfac540
commit f4de17acf5
6 changed files with 27 additions and 27 deletions

View file

@ -1,6 +1,8 @@
var del = require('del');
gulp.task('clean', function () {
del.sync(config.outputDir + '/{css,js}');
del.sync('output_*/assets/{css,js}');
del.sync(config.fonts.outputDir);
del.sync(config.js.outputDir);
del.sync(config.sass.outputDir);
del.sync('output_*/assets/{css,fonts,js}');
});

View file

@ -1,6 +1,6 @@
gulp.task('fonts', function () {
app.copy(
config.bowerDir + '/font-awesome/fonts/*',
config.fonts.output
config.fonts.outputDir
);
});

View file

@ -1,10 +1,7 @@
gulp.task('scripts', function () {
app.js(
[
app.js([
config.bowerDir + '/jquery/dist/jquery.js',
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js',
config.js.search
],
'site.js'
);
config.js.pattern
], 'site.js');
});

View file

@ -1,6 +1,6 @@
gulp.task('styles', function () {
app.css([
app.sass([
config.bowerDir + '/font-awesome/css/font-awesome.css',
config.sass.source + '/site.sass'
config.sass.sourceDir + '/site.sass'
], 'site.css');
});

View file

@ -1,7 +1,8 @@
gulp.task('watch', function () {
plugins.refresh.listen();
gulp.watch(config.sass.source + config.sass.search, ['styles']);
gulp.watch(config.sass.source + config.scss.search, ['styles']);
gulp.watch(config.js.source + config.js.search, ['scripts']);
gulp.watch(config.sass.sourceDir + config.sass.pattern, ['styles']);
gulp.watch(config.sass.sourceDir + config.scss.pattern, ['styles']);
gulp.watch(config.js.sourceDir + config.js.pattern, ['scripts']);
});

View file

@ -9,30 +9,30 @@ global.config = {
},
bowerDir: 'vendor/bower',
fonts: {
output: 'source/assets/fonts'
outputDir: 'source/assets/fonts'
},
htmlmin: {
collapseWhitespace: true
},
js: {
source: 'assets/js',
search: '/js/**/*.js',
output: 'source/assets/js'
sourceDir: 'assets/js',
pattern: '/js/**/*.js',
outputDir: 'source/assets/js'
},
production: plugins.util.env.production || false,
sass: {
source: 'assets/sass',
search: '/**/*.sass',
output: 'source/assets/css'
sourceDir: 'assets/sass',
pattern: '/**/*.sass',
outputDir: 'source/assets/css'
},
scss: {
search: '/**/*.scss'
pattern: '/**/*.scss'
}
}
global.app = {};
app.css = function (paths, filename) {
app.sass = function (paths, filename) {
gulp.src(paths)
.pipe(plugins.plumber())
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
@ -43,7 +43,7 @@ app.css = function (paths, filename) {
.pipe(plugins.if(config.production, plugins.cleanCss()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
.pipe(plugins.if(!config.production, plugins.refresh()))
.pipe(gulp.dest(config.sass.output));
.pipe(gulp.dest(config.sass.outputDir));
};
app.js = function (paths, filename) {
@ -53,7 +53,7 @@ app.js = function (paths, filename) {
.pipe(plugins.concat(filename))
.pipe(plugins.if(config.production, plugins.uglify()))
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
.pipe(gulp.dest(config.js.output));
.pipe(gulp.dest(config.js.outputDir));
};
app.copy = function (source, destination) {