Skip to content

Commit

Permalink
Add browserify gulp to get a single js file
Browse files Browse the repository at this point in the history
  • Loading branch information
quentinfayet committed Nov 15, 2015
1 parent e4d93a6 commit f76e42b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
15 changes: 11 additions & 4 deletions client/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var ngAnnotate = require('gulp-ng-annotate');
var uglify = require('gulp-uglify');
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');

gulp.task('watch', ['build', 'copy-bower-components'], function () {
gulp.watch(['static/js/**/*.js',
Expand All @@ -26,10 +28,15 @@ gulp.task('style', function () {
});

gulp.task('build', function () {
return gulp.src('static/js/**/*.js')
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(gulp.dest('public/js/'));
return gulp.src('static/js/language.js')
.pipe(browserify({
insertGlobal: true,
debug: true
}))
.pipe(ngAnnotate())
.pipe(uglify())
.pipe(concat('language.js'))
.pipe(gulp.dest('public/js/'));
});

gulp.task('copy-bower-components', function() {
Expand Down
3 changes: 3 additions & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
"gulp-uglify": "^1.4.2"
},
"devDependencies": {
"browserify": "^12.0.1",
"gulp-browserify": "^0.5.1",
"gulp-concat": "^2.6.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.1.0"
}
Expand Down
3 changes: 0 additions & 3 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-aria.js"></script>
<script src="//cdn.jsdelivr.net/angular-material-icons/0.4.0/angular-material-icons.min.js"></script>
<script src="libs/angular-cookies/angular-cookies.js"></script>
<script src="js/authentication/services/authentication.service.js"></script>
<script src="js/authentication/controllers/register.controller.js"></script>
<script src="js/authentication/authentication.js"></script>
<script src="js/language.js"></script>
</head>
<body layout="row" ng-controller="RegistrationController as registration">
Expand Down
2 changes: 2 additions & 0 deletions client/static/js/authentication/authentication.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
require('./controllers/register.controller');

angular.module('Language.Authentication', ['Language.Authentication.controllers', 'ngMaterial']);
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('../services/authentication.service');

function RegistrationController ($location, $scope, Authentication) {
var vm = this;

Expand Down
2 changes: 2 additions & 0 deletions client/static/js/language.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require('./authentication/authentication');

angular.module('Language', ['Language.Authentication'])
.config(function($mdThemingProvider) {
var customBlueMap = $mdThemingProvider.extendPalette('light-blue', {
Expand Down

0 comments on commit f76e42b

Please sign in to comment.