forked from Sylius/Sylius
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Gulp] Split gulpfiles and make them configurable
- Loading branch information
Showing
9 changed files
with
137 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,30 @@ | ||
var gulp = require('gulp'); | ||
var chug = require('gulp-chug'); | ||
var argv = require('yargs').argv; | ||
|
||
config = [ | ||
'--rootPath', | ||
argv.rootPath || '../../../../web/assets/', | ||
'--nodeModulesPath', | ||
argv.nodeModulesPath || '../../../../node_modules/' | ||
]; | ||
|
||
gulp.task('ui', function() { | ||
gulp.src('src/Sylius/Bundle/UiBundle/Gulpfile.js', { read: false }) | ||
.pipe(chug({ args: config })) | ||
; | ||
}); | ||
|
||
gulp.task('admin', function() { | ||
gulp.src('src/Sylius/Bundle/AdminBundle/Gulpfile.js', { read: false }) | ||
.pipe(chug()) | ||
.pipe(chug({ args: config })) | ||
; | ||
}); | ||
|
||
gulp.task('shop', function() { | ||
gulp.src('src/Sylius/Bundle/ShopBundle/Gulpfile.js', { read: false }) | ||
.pipe(chug()) | ||
.pipe(chug({ args: config })) | ||
; | ||
}); | ||
|
||
gulp.task('default', ['admin', 'shop']); | ||
gulp.task('default', ['ui', 'admin', 'shop']); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
var concat = require('gulp-concat'); | ||
var env = process.env.GULP_ENV; | ||
var gulp = require('gulp'); | ||
var gulpif = require('gulp-if'); | ||
var livereload = require('gulp-livereload'); | ||
var merge = require('merge-stream'); | ||
var order = require('gulp-order'); | ||
var sass = require('gulp-sass'); | ||
var sourcemaps = require('gulp-sourcemaps'); | ||
var uglify = require('gulp-uglify'); | ||
var uglifycss = require('gulp-uglifycss'); | ||
var argv = require('yargs').argv; | ||
|
||
var rootPath = argv.rootPath; | ||
var uiRootPath = rootPath + 'ui/'; | ||
var resourcePath = argv.resourcePath || ''; | ||
var nodeModulesPath = argv.nodeModulesPath; | ||
|
||
var paths = { | ||
ui: { | ||
js: [ | ||
resourcePath + 'Resources/private/js/**' | ||
], | ||
sass: [ | ||
resourcePath + 'Resources/private/sass/**' | ||
], | ||
css: [ | ||
resourcePath + 'Resources/private/css/**' | ||
], | ||
img: [ | ||
resourcePath + 'Resources/private/img/**' | ||
] | ||
}, | ||
nodeModules: { | ||
js: [ | ||
nodeModulesPath + 'jquery/dist/jquery.min.js', | ||
nodeModulesPath + 'semantic-ui-css/semantic.min.js' | ||
], | ||
css: [ | ||
nodeModulesPath + 'semantic-ui-css/semantic.min.css' | ||
] | ||
} | ||
}; | ||
|
||
gulp.task('ui-js', function () { | ||
var nodeModulesJsStream = gulp.src(paths.nodeModules.js) | ||
.pipe(concat('node-modules.js')) | ||
; | ||
|
||
var uiJsStream = gulp.src(paths.ui.js) | ||
.pipe(concat('ui.js')) | ||
; | ||
|
||
return merge(nodeModulesJsStream, uiJsStream) | ||
.pipe(order(['node-modules.js', 'ui.js'])) | ||
.pipe(concat('app.js')) | ||
.pipe(gulpif(env === 'prod', uglify())) | ||
.pipe(sourcemaps.write('./')) | ||
.pipe(gulp.dest(uiRootPath + 'js/')) | ||
; | ||
}); | ||
|
||
gulp.task('ui-css', function() { | ||
gulp.src([nodeModulesPath+'semantic-ui-css/themes/**/*']).pipe(gulp.dest(uiRootPath + 'css/themes/')); | ||
|
||
var nodeModulesCssStream = gulp.src(paths.nodeModules.css) | ||
.pipe(concat('node-modules-css-files.css')) | ||
; | ||
|
||
var cssStream = gulp.src(paths.ui.css) | ||
.pipe(concat('css-files.css')) | ||
; | ||
|
||
var sassStream = gulp.src(paths.ui.sass) | ||
.pipe(sass()) | ||
.pipe(concat('sass-files.scss')) | ||
; | ||
|
||
return merge(nodeModulesCssStream, cssStream, sassStream) | ||
.pipe(order(['node-modules-css-files.css', 'css-files.css', 'sass-files.scss'])) | ||
.pipe(concat('style.css')) | ||
.pipe(gulpif(env === 'prod', uglifycss())) | ||
.pipe(sourcemaps.write('./')) | ||
.pipe(gulp.dest(uiRootPath + 'css/')) | ||
.pipe(livereload()) | ||
; | ||
}); | ||
|
||
gulp.task('ui-img', function() { | ||
return gulp.src(paths.ui.img) | ||
.pipe(sourcemaps.write('./')) | ||
.pipe(gulp.dest(uiRootPath + 'img/')) | ||
; | ||
}); | ||
|
||
gulp.task('default', ['ui-js', 'ui-css', 'ui-img']); |
This file contains 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
This file contains 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