Commit 4369f5a2 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] add browserify option

parent bbef17af
......@@ -113,6 +113,20 @@ module.exports = yeoman.generators.Base.extend((function() {
});
}
},
javascriptPrompts: function() {
if (answers.projectType !== 'extbaseExtension') {
var done = this.async();
this.prompt({
type: 'confirm',
name: 'browserify',
message: 'Do you want to use Browserify for organizing you JS modules?',
default: 'Y/n'
}, function(_answers) {
answers = _.extend(answers, _answers);
done();
});
}
},
configPrompts: function() {
if (answers.projectType !== 'extbaseExtension') {
var done = this.async();
......
......@@ -13,8 +13,10 @@
"gulp-minify-css": "^0.3.11",
"gulp-imagemin": "^2.1.0",
"gulp-jshint": "^1.9.0",
"jshint-stylish": "^1.0.0",
"gulp-concat": "^2.4.3",
"jshint-stylish": "^1.0.0",<% if (browserify) { %>
"vinyl-source-stream": "^1.0.0",
"browserify": "^8.1.0",<% } else { %>
"gulp-concat": "^2.4.3",<% } %>
"gulp-uglify": "^1.0.2",
"require-dir": "^0.1.0",
"yargs": "^1.3.3",
......
......@@ -2,8 +2,10 @@
var gulp = require('gulp'),
settings = require('./settings'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
jshint = require('gulp-jshint'),<% if (browserify) { %>
browserify = require('browserify'),
source = require('vinyl-source-stream'),<% } else { %>
concat = require('gulp-concat'),<% } %>
uglify = require('gulp-uglify');
gulp.task('jshint', function() {
......@@ -13,10 +15,20 @@ gulp.task('jshint', function() {
});
gulp.task('javascript', function() {
<% if (browserify) { %>
gulp.src(settings.path.javascript + '/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
return browserify('./' + settings.path.javascript + '/main.js')
.bundle()
.pipe(source('main.js'))
.pipe(gulp.dest('.'));
<% } else { %>
return gulp.src(settings.path.javascript + '/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(concat('main.js'))
.pipe(uglify())
.pipe(gulp.dest('./'));
<% } %>
});
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