Commit 79881fb7 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] make pipline more configurable

parent a96b3ee1
'use strict';
var gulp = require('gulp'),
let gulp = require('gulp'),
path = require('path'),
settings = require('./settings'),
config = settings.getConfig(),
......@@ -14,19 +14,23 @@ var gulp = require('gulp'),
lazypipe = require('lazypipe');
function processCss() {
var filter = plugins.filter(filterPattern, {restore: true}),
let filter = plugins.filter(filterPattern, {restore: true}),
compilationProcess = lazypipe()
.pipe(plugins.sass, {precision: 8})
.pipe(plugins.cssImageDimensions, path.resolve(settings.getPath() + '/' + config.directories.images))
.pipe(plugins.autoprefixer, {
browsers: ['last 1 version', '> 1%', 'ie 8']
browsers: config.css.supportedBrowsers ? config.css.supportedBrowsers : ['last 1 version', '> 1%', 'ie 8']
})
.pipe(plugins.cleanCss, {
"restructuring": false,
"advanced": false
.pipe(function() {
return plugins.if(config.css.pipeline.cleanCss, plugins.cleanCss({
"restructuring": false,
"advanced": false
}));
})
.pipe(plugins.rename, {
suffix: '.min'
.pipe(function() {
return plugins.if(config.css.pipeline.renameToDotMin, plugins.rename({
suffix: '.min'
}));
});
if (argv.production) {
......@@ -60,7 +64,7 @@ function processCssAndSync() {
gulp.task('css:sprites', function() {
// Generate our spritesheet
var spriteData = gulp.src(settings.getPath() + '/' + config.directories.sprites + '/**/*.png').pipe(plugins.spritesmith({
let spriteData = gulp.src(settings.getPath() + '/' + config.directories.sprites + '/**/*.png').pipe(plugins.spritesmith({
imgName: 'sprites.png',
cssName: '_sprite.scss',
imgPath: '/' + settings.getPath(true) + '/' + config.directories.images + '/sprites.png',
......@@ -68,14 +72,14 @@ gulp.task('css:sprites', function() {
}));
// Pipe image stream through image optimizer and onto disk
var imgStream = spriteData.img
let imgStream = spriteData.img
.pipe(buffer())
.pipe(plugins.imagemin({
progressive: true
}))
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.images));
var cssStream = spriteData.css
let cssStream = spriteData.css
.pipe(gulp.dest(settings.getPath() + '/' + config.directories.sass));
return merge(imgStream, cssStream);
......
'use strict';
var gulp = require('gulp'),
const gulp = require('gulp'),
settings = require('./settings'),
config = settings.getConfig(),
path = require('path'),
argv = require('yargs').argv,
glob = require('glob'),
compiler,
plugins = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*', 'browserify', 'browser-sync']
});
let compiler;
function setUpCompiler() {
if (!config.js.compiler) {
plugins.util.log(plugins.util.colors.red('No compiler specified!'));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment