Skip to content

Commit

Permalink
Changed gulp build process to generate concatenated files for better …
Browse files Browse the repository at this point in the history
…performance. Added source mapping for vendor files and routing to original source in vhost.
  • Loading branch information
zakhenry committed Nov 11, 2015
1 parent 69f064d commit 4cd7593
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
13 changes: 9 additions & 4 deletions gulpfile.js
Expand Up @@ -138,6 +138,8 @@ gulp.task('scripts:app', 'processes javascript & typescript files', [], function

tsResult.js
.pipe(tsFilter.restore())
.pipe(plugins.sort())
.pipe(plugins.concat(packageJson.name + '.js'))
.pipe(plugins.sourcemaps.write('./', {includeContent: false, sourceRoot: __dirname+'/app/src/'}))
.pipe(gulp.dest(paths.dest.scripts))
]);
Expand Down Expand Up @@ -165,6 +167,8 @@ gulp.task('scripts:test', 'processes javascript & typescript tests', [], functio
;

return tsResult.js
.pipe(plugins.sort())
.pipe(plugins.concat(packageJson.name + '.spec.js'))
.pipe(plugins.sourcemaps.write('./', {includeContent: false, sourceRoot: __dirname+'/app/src/'}))
.pipe(gulp.dest(paths.dest.tests))
;
Expand Down Expand Up @@ -227,6 +231,9 @@ gulp.task('bower:build', 'compiles frontend vendor files', [], function(cb) {
//javascript
.pipe(jsFilter)
.on('error', onError)
.pipe(plugins.sourcemaps.init())
.pipe(plugins.concat(packageJson.name + '.vendor.js'))
.pipe(plugins.sourcemaps.write('./', {includeContent: false, sourceRoot: __dirname+'/app/bower_components/'}))
.pipe(gulp.dest(paths.dest.vendor+'/js'))
.pipe(jsFilter.restore())
//css
Expand Down Expand Up @@ -270,8 +277,8 @@ var getIndexFiles = function(conf){
app: plugins.globby.sync(paths.dest.scripts+'/**/*.js').map(function(path){
return path.replace('app/build/', '');
}),
vendor: vendorFiles.filter(plugins.minimatch.filter("*.js", {matchBase: true})).map(function(path){
return 'vendor/js/'+path;
vendor: plugins.globby.sync(paths.dest.vendor+'/**/*.js').map(function(path){
return path.replace('app/build/', '');
})
},
styles: {
Expand Down Expand Up @@ -356,8 +363,6 @@ gulp.task('test:karma', 'unit test the frontend', [], function(done){
.concat(plugins.globby.sync(paths.dest.tests+'/**/*.js'))
;

testFiles.push('app/build/js/templates.js');

var karmaConfig = {
configFile: __dirname + '/karma.conf.js',
singleRun: true,
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Expand Up @@ -4,7 +4,7 @@ module.exports = function(config) {
frameworks: ['chai-as-promised', 'mocha', 'sinon', 'sinon-chai'],

preprocessors: {
'app/build/**/*.js': ['coverage']
'app/build/**/!(*vendor)/*.js': ['coverage']
},

reporters: ['mocha', 'coverage'],
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -47,6 +47,7 @@
"gulp-notify": "^2.2.0",
"gulp-phpunit": "^0.8.1",
"gulp-replace": "^0.5.3",
"gulp-sort": "^1.1.1",
"gulp-sourcemaps": "^1.5.1",
"gulp-template": "^3.0.0",
"gulp-tsc": "^0.10.1",
Expand Down
4 changes: 4 additions & 0 deletions vhosts/nginx/dev/spira-app.conf
Expand Up @@ -14,6 +14,10 @@ server {
root /;
try_files $uri $uri/ =404;
}
location %DATA_ROOT%/app/bower_components {
root /;
try_files $uri $uri/ =404;
}

location / {
root %DATA_ROOT%/app/build;
Expand Down

0 comments on commit 4cd7593

Please sign in to comment.