Update Gulp config
This commit is contained in:
parent
0a938593a6
commit
6dabfac540
|
@ -1,6 +1,6 @@
|
||||||
gulp.task('fonts', function () {
|
gulp.task('fonts', function () {
|
||||||
app.copy(
|
app.copy(
|
||||||
config.bowerDir + '/font-awesome/fonts/*',
|
config.bowerDir + '/font-awesome/fonts/*',
|
||||||
config.outputDir + '/fonts'
|
config.fonts.output
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
gulp.task('minify-prod-html', function () {
|
gulp.task('minify-prod-html', function () {
|
||||||
gulp.src('output_prod/**/*.html')
|
gulp.src('output_prod/**/*.html')
|
||||||
.pipe(plugins.htmlmin({ collapseWhitespace: true }))
|
.pipe(plugins.htmlmin(config.htmlminp))
|
||||||
.pipe(gulp.dest('output_prod'));
|
.pipe(gulp.dest('output_prod'));
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ gulp.task('scripts', function () {
|
||||||
[
|
[
|
||||||
config.bowerDir + '/jquery/dist/jquery.js',
|
config.bowerDir + '/jquery/dist/jquery.js',
|
||||||
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js',
|
config.bowerDir + '/bootstrap-sass/assets/javascripts/bootstrap.js',
|
||||||
config.assetsDir + '/' + config.jsPattern
|
config.js.search
|
||||||
],
|
],
|
||||||
'site.js'
|
'site.js'
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
gulp.task('styles', function () {
|
gulp.task('styles', function () {
|
||||||
app.css([
|
app.css([
|
||||||
config.bowerDir + '/font-awesome/css/font-awesome.css',
|
config.bowerDir + '/font-awesome/css/font-awesome.css',
|
||||||
config.assetsDir + '/sass/site.sass'
|
config.sass.source + '/site.sass'
|
||||||
], 'site.css');
|
], 'site.css');
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
gulp.task('watch', function () {
|
gulp.task('watch', function () {
|
||||||
plugins.refresh.listen();
|
plugins.refresh.listen();
|
||||||
|
|
||||||
gulp.watch(config.assetsDir + '/' + config.sassPattern, ['styles']);
|
gulp.watch(config.sass.source + config.sass.search, ['styles']);
|
||||||
gulp.watch(config.assetsDir + '/' + config.jsPattern, ['scripts']);
|
gulp.watch(config.sass.source + config.scss.search, ['styles']);
|
||||||
|
gulp.watch(config.js.source + config.js.search, ['scripts']);
|
||||||
});
|
});
|
||||||
|
|
33
gulpfile.js
33
gulpfile.js
|
@ -4,12 +4,30 @@ global.gulp = require('gulp');
|
||||||
global.plugins = require('gulp-load-plugins')();
|
global.plugins = require('gulp-load-plugins')();
|
||||||
|
|
||||||
global.config = {
|
global.config = {
|
||||||
assetsDir: 'assets',
|
autoprefixer: {
|
||||||
|
browsers: 'last 2 versions'
|
||||||
|
},
|
||||||
bowerDir: 'vendor/bower',
|
bowerDir: 'vendor/bower',
|
||||||
jsPattern: 'js/**/*.js',
|
fonts: {
|
||||||
outputDir: 'source/assets',
|
output: 'source/assets/fonts'
|
||||||
|
},
|
||||||
|
htmlmin: {
|
||||||
|
collapseWhitespace: true
|
||||||
|
},
|
||||||
|
js: {
|
||||||
|
source: 'assets/js',
|
||||||
|
search: '/js/**/*.js',
|
||||||
|
output: 'source/assets/js'
|
||||||
|
},
|
||||||
production: plugins.util.env.production || false,
|
production: plugins.util.env.production || false,
|
||||||
sassPattern: 'sass/**/*.sass',
|
sass: {
|
||||||
|
source: 'assets/sass',
|
||||||
|
search: '/**/*.sass',
|
||||||
|
output: 'source/assets/css'
|
||||||
|
},
|
||||||
|
scss: {
|
||||||
|
search: '/**/*.scss'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
global.app = {};
|
global.app = {};
|
||||||
|
@ -20,13 +38,12 @@ app.css = function (paths, filename) {
|
||||||
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
.pipe(plugins.if(!config.production, plugins.sourcemaps.init()))
|
||||||
.pipe(plugins.sassGlob())
|
.pipe(plugins.sassGlob())
|
||||||
.pipe(plugins.sass())
|
.pipe(plugins.sass())
|
||||||
.pipe(plugins.autoprefixer({ browsers: 'last 2 versions' }))
|
.pipe(plugins.autoprefixer(config.autoprefixer))
|
||||||
.pipe(plugins.concat(filename))
|
.pipe(plugins.concat(filename))
|
||||||
.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, gulp.dest(config.outputDir + '/css')))
|
|
||||||
.pipe(plugins.if(!config.production, plugins.refresh()))
|
.pipe(plugins.if(!config.production, plugins.refresh()))
|
||||||
.pipe(gulp.dest(config.outputDir + '/css'));
|
.pipe(gulp.dest(config.sass.output));
|
||||||
};
|
};
|
||||||
|
|
||||||
app.js = function (paths, filename) {
|
app.js = function (paths, filename) {
|
||||||
|
@ -36,7 +53,7 @@ app.js = function (paths, filename) {
|
||||||
.pipe(plugins.concat(filename))
|
.pipe(plugins.concat(filename))
|
||||||
.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.outputDir + '/js'));
|
.pipe(gulp.dest(config.js.output));
|
||||||
};
|
};
|
||||||
|
|
||||||
app.copy = function (source, destination) {
|
app.copy = function (source, destination) {
|
||||||
|
|
Loading…
Reference in a new issue