Created
September 22, 2016 14:14
-
-
Save petyappetrov/af9e3c4ed30129398d08912af449c232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
var gulp = require('gulp'); | |
var path = require('path'); | |
var changed = require('gulp-changed'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var rename = require('gulp-rename'); | |
var runSequence = require('run-sequence'); | |
var shell = require('gulp-shell'); | |
var composer = require('gulp-composer'); | |
var postcss = require('gulp-postcss'); | |
var precss = require('precss'); | |
var short = require('postcss-short'); | |
var cssnext = require('postcss-cssnext'); | |
var lostGrid = require('lost'); | |
var postcssSvg = require('postcss-svg'); | |
var svgo = require('postcss-svgo'); | |
var cssMqpacker = require('css-mqpacker'); | |
var hoverFocus = require('postcss-focus'); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
var config = { | |
entry: './vanare-oro/websrc/apps/platform/pages/ManageClients/**/*.scss', | |
output: './vanare-oro/web/assets/css/apps/platform/pages/ManageClients/' | |
}; | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
var processors = [ | |
precss, | |
short, | |
hoverFocus, | |
cssnext({ | |
browsers: [ | |
'last 3 versions', | |
'IE >= 9', | |
'Chrome >= 42', | |
'Firefox >= 38', | |
'iOS >= 7', | |
'Android >= 4', | |
] | |
}), | |
lostGrid, | |
postcssSvg({ | |
paths: ['./vanare-oro/src/Vanare/WebsiteBundle/Resources/public/images/svg'], | |
}), | |
svgo({ | |
encode: true, | |
plugins: [{ | |
removeStyleElement: true | |
}, { | |
convertShapeToPath: false | |
}] | |
}), | |
cssMqpacker | |
]; | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('postcss', function() { | |
return gulp.src(config.entry) | |
.pipe(changed(config.output, {extension: '.css'})) | |
.pipe(rename({extname: '.css'})) | |
.pipe(sourcemaps.init()) | |
.pipe(postcss(processors)) | |
.pipe(sourcemaps.write()) | |
.pipe(gulp.dest(config.output)) | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('assets', function() { | |
return gulp.src('./vanare-oro') | |
.pipe(shell([ | |
'php vanare-oro/app/console assets:install --symlink vanare-oro/web', | |
'php vanare-oro/app/console assetic:dump' | |
])); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('migration', function() { | |
return gulp.src('./vanare-oro') | |
.pipe(shell([ | |
'php vanare-oro/app/console --env=dev doctrine:migrations:migrate', | |
'php vanare-oro/app/console oro:migration:load --force', | |
'php vanare-oro/app/console oro:entity-extend:update-schema', | |
'php vanare-oro/app/console oro:entity-extend:update-config', | |
'php vanare-oro/app/console oro:entity-config:init', | |
'php vanare-oro/app/console oro:entity-config:update', | |
'php vanare-oro/app/console oro:entity-config:cache:clear', | |
'php vanare-oro/app/console oro:entity-extend:cache:clear', | |
'rm -f -R ./vanare-oro/app/cache/*', | |
'php vanare-oro/app/console cache:clear', | |
'php vanare-oro/app/console cache:clear --env=prod', | |
'php vanare-oro/app/console fos:js-routing:dump', | |
'php vanare-oro/app/console assets:install --symlink vanare-oro/web', | |
'php vanare-oro/app/console assetic:dump' | |
])); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('composer', function() { | |
return composer({'working-dir': './vanare-oro'}); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('initialize', function() { | |
return runSequence('composer', 'migration'); | |
}); | |
//////////////////////////////////////////////////////////////////////////////////////////////////// | |
gulp.task('default', function() { | |
return gulp.watch(config.entry, function() { | |
return runSequence('postcss', 'assets'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment