Tidy gulpfile
This commit is contained in:
parent
546cf208fc
commit
7f4a36f906
59
gulpfile.js
59
gulpfile.js
|
@ -6,10 +6,12 @@ var del = require('del');
|
||||||
|
|
||||||
var config = require('./gulpfile.config')(plugins);
|
var config = require('./gulpfile.config')(plugins);
|
||||||
|
|
||||||
var app = {};
|
gulp.task('styles', function() {
|
||||||
|
return gulp.src([
|
||||||
app.sass = function(paths, filename) {
|
config.bower.path + '/font-awesome/css/font-awesome.css',
|
||||||
return gulp.src(paths)
|
config.bower.path + '/highlightjs/styles/default.css',
|
||||||
|
config.sass.source + config.sass.pattern
|
||||||
|
])
|
||||||
.pipe(plugins.plumber())
|
.pipe(plugins.plumber())
|
||||||
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
||||||
.pipe(plugins.sassGlob())
|
.pipe(plugins.sassGlob())
|
||||||
|
@ -18,27 +20,32 @@ app.sass = function(paths, filename) {
|
||||||
browsers: config.autoprefixer.browsers,
|
browsers: config.autoprefixer.browsers,
|
||||||
cascade: false
|
cascade: false
|
||||||
}))
|
}))
|
||||||
.pipe(plugins.concat(filename))
|
.pipe(plugins.concat('site.css'))
|
||||||
.pipe(plugins.if(config.production, plugins.cleanCss()))
|
.pipe(plugins.if(config.production, plugins.cleanCss()))
|
||||||
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
|
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
|
||||||
.pipe(plugins.if(!config.production, plugins.refresh()))
|
.pipe(plugins.if(!config.production, plugins.refresh()))
|
||||||
.pipe(gulp.dest(config.sass.destination));
|
.pipe(gulp.dest(config.sass.destination));
|
||||||
};
|
});
|
||||||
|
|
||||||
app.js = function(paths, filename) {
|
gulp.task('scripts', function() {
|
||||||
return gulp.src(paths)
|
return gulp.src([
|
||||||
|
config.bower.path + '/jquery2/jquery.js',
|
||||||
|
config.bower.path + '/bootstrap-sass/assets/javascripts/bootstrap.js',
|
||||||
|
config.bower.path + '/highlightjs/highlight.pack.js',
|
||||||
|
config.js.source + config.js.pattern
|
||||||
|
])
|
||||||
.pipe(plugins.plumber())
|
.pipe(plugins.plumber())
|
||||||
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
||||||
.pipe(plugins.concat(filename))
|
.pipe(plugins.concat('site.js'))
|
||||||
.pipe(plugins.if(config.production, plugins.uglify()))
|
.pipe(plugins.if(config.production, plugins.uglify()))
|
||||||
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
|
.pipe(plugins.if(!config.production, plugins.sourcemaps.write('.')))
|
||||||
.pipe(gulp.dest(config.js.destination));
|
.pipe(gulp.dest(config.js.destination));
|
||||||
};
|
});
|
||||||
|
|
||||||
app.copy = function(source, destination) {
|
gulp.task('fonts', function() {
|
||||||
return gulp.src(source)
|
return gulp.src(config.bower.path + "/font-awesome/fonts/*")
|
||||||
.pipe(gulp.dest(destination));
|
.pipe(gulp.dest(config.fonts.destination));
|
||||||
};
|
});
|
||||||
|
|
||||||
gulp.task('clean', function() {
|
gulp.task('clean', function() {
|
||||||
del.sync(config.fonts.destination);
|
del.sync(config.fonts.destination);
|
||||||
|
@ -49,30 +56,6 @@ gulp.task('clean', function() {
|
||||||
del.sync('output_*/assets/js');
|
del.sync('output_*/assets/js');
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('fonts', function() {
|
|
||||||
return app.copy(
|
|
||||||
config.bower.path + "/font-awesome/fonts/*",
|
|
||||||
config.fonts.destination
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('styles', function() {
|
|
||||||
return app.sass([
|
|
||||||
config.bower.path + '/font-awesome/css/font-awesome.css',
|
|
||||||
config.bower.path + '/highlightjs/styles/default.css',
|
|
||||||
config.sass.source + config.sass.pattern
|
|
||||||
], 'site.css');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('scripts', function() {
|
|
||||||
return app.js([
|
|
||||||
config.bower.path + '/jquery2/jquery.js',
|
|
||||||
config.bower.path + '/bootstrap-sass/assets/javascripts/bootstrap.js',
|
|
||||||
config.bower.path + '/highlightjs/highlight.pack.js',
|
|
||||||
config.js.source + config.js.pattern
|
|
||||||
], 'site.js');
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task('default', ['clean', 'fonts', 'styles', 'scripts']);
|
gulp.task('default', ['clean', 'fonts', 'styles', 'scripts']);
|
||||||
|
|
||||||
gulp.task('watch', ['default'], function() {
|
gulp.task('watch', ['default'], function() {
|
||||||
|
|
Loading…
Reference in a new issue