Skip to content

Commit 9e23799

Browse files
Merge remote-tracking branch 'upstream/master'
# Conflicts: # gulp/tasks/clean.js # package.json
2 parents 73f88a2 + e433186 commit 9e23799

File tree

9 files changed

+42
-38
lines changed

9 files changed

+42
-38
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
angularjs-cordova-gulp-browserify-boilerplate
22
=====================================
3+
[![devDependency Status](https://david-dm.org/jakemmarsh/angularjs-gulp-browserify-boilerplate/dev-status.svg)](https://david-dm.org/jakemmarsh/angularjs-gulp-browserify-boilerplate#info=devDependencies)
34

45
A boilerplate using AngularJS SASS, Gulp, and Browserify that also utilizes [these best AngularJS practices](https://github.com/toddmotto/angularjs-styleguide) and Gulp best practices from [this resource](https://github.com/greypants/gulp-starter). Cordova support intergrated for quick app developement.
56

gulp/tasks/browserify.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ import debowerify from 'debowerify';
1818
import ngAnnotate from 'browserify-ngannotate';
1919
import fs from 'fs';
2020

21+
function createSourcemap() {
22+
return !global.isProd || config.browserify.prodSourcemap;
23+
}
24+
2125
// Based on: http://blog.avisi.nl/2014/04/25/how-to-keep-a-fast-build-with-browserify-and-reactjs/
2226
function buildScript(file) {
23-
24-
var bundler = browserify({
27+
28+
let bundler = browserify({
2529
entries: [config.sourceDir + 'js/' + file],
26-
debug: true,
30+
debug: createSourcemap(),
2731
cache: {},
2832
packageCache: {},
2933
fullPaths: !global.isProd
@@ -73,18 +77,18 @@ function buildScript(file) {
7377

7478
function rebundle() {
7579
const stream = bundler.bundle();
76-
const createSourcemap = global.isProd && config.browserify.prodSourcemap;
80+
const sourceMapLocation = global.isProd ? './' : '';
7781

7882
return stream.on('error', handleErrors)
7983
.pipe(source(file))
80-
.pipe(gulpif(createSourcemap, buffer()))
81-
.pipe(gulpif(createSourcemap, sourcemaps.init()))
84+
.pipe(gulpif(createSourcemap(), buffer()))
85+
.pipe(gulpif(createSourcemap(), sourcemaps.init({ loadMaps: true })))
8286
.pipe(gulpif(global.isProd, streamify(uglify({
8387
compress: { drop_console: true }
8488
}))))
85-
.pipe(gulpif(createSourcemap, sourcemaps.write('./')))
89+
.pipe(gulpif(createSourcemap(), sourcemaps.write(sourceMapLocation)))
8690
.pipe(gulp.dest(config.scripts.dest))
87-
.pipe(browserSync.stream({ once: true }));
91+
.pipe(browserSync.stream());
8892
}
8993

9094
return rebundle();

gulp/tasks/clean.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import gulp from 'gulp';
55
import del from 'del';
66
import file from 'gulp-file';
77

8-
gulp.task('clean', function(cb) {
8+
gulp.task('clean', function() {
99

10-
del([config.buildDir],function(){
10+
return del([config.buildDir],function(){
1111
//Cordova requires www, so lets keep the folder using .gitkeep even if its empty after a clean.
1212
file('.gitkeep', '', { src: true }).pipe(gulp.dest(config.buildDir));
13-
cb();
1413
});
1514

1615
});

gulp/tasks/fonts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ gulp.task('fonts', function() {
1010
return gulp.src(config.fonts.src)
1111
.pipe(changed(config.fonts.dest)) // Ignore unchanged files
1212
.pipe(gulp.dest(config.fonts.dest))
13-
.pipe(browserSync.stream({ once: true }));
13+
.pipe(browserSync.stream());
1414

1515
});

gulp/tasks/images.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ gulp.task('images', function() {
1313
.pipe(changed(config.images.dest)) // Ignore unchanged files
1414
.pipe(gulpif(global.isProd, imagemin())) // Optimize
1515
.pipe(gulp.dest(config.images.dest))
16-
.pipe(browserSync.stream({ once: true }));
16+
.pipe(browserSync.stream());
1717

18-
});
18+
});

gulp/tasks/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ gulp.task('styles', function () {
2727
sourcemaps.write( global.isProd ? './' : null ))
2828
)
2929
.pipe(gulp.dest(config.styles.dest))
30-
.pipe(browserSync.stream({ once: true }));
30+
.pipe(browserSync.stream());
3131

3232
});

gulp/tasks/views.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ gulp.task('views', function() {
1818
standalone: true
1919
}))
2020
.pipe(gulp.dest(config.views.dest))
21-
.pipe(browserSync.stream({ once: true }));
21+
.pipe(browserSync.stream());
2222

23-
});
23+
});

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,64 +23,63 @@
2323
"protractor",
2424
"boilerplate"
2525
],
26-
"private": true,
26+
"private": false,
2727
"engines": {
2828
"node": ">=0.12.x"
2929
},
3030
"devDependencies": {
3131
"babel-core": "^5.8.25",
32-
"babelify": "^6.3.0",
32+
"babelify": "^6.4.0",
3333
"brfs": "^1.2.0",
3434
"browser-sync": "^2.7.6",
3535
"browserify": "^12.0.0",
3636
"browserify-istanbul": "^0.2.1",
37-
"browserify-ngannotate": "^1.0.1",
37+
"browserify-ngannotate": "^2.0.0",
3838
"browserify-shim": "^3.8.9",
3939
"bulk-require": "^0.2.1",
4040
"bulkify": "^1.1.1",
4141
"cordova": "^5.1.1",
4242
"debowerify": "^1.3.1",
43-
"del": "^0.1.3",
43+
"del": "^2.1.0",
4444
"fs": "0.0.2",
4545
"gulp": "^3.8.8",
4646
"gulp-angular-templatecache": "^1.3.0",
47-
"gulp-autoprefixer": "^2.0.0",
47+
"gulp-autoprefixer": "^3.1.0",
4848
"gulp-changed": "^1.0.0",
4949
"gulp-file": "^0.2.0",
50-
"gulp-gzip": "^0.0.8",
51-
"gulp-if": "^1.2.5",
52-
"gulp-imagemin": "^1.1.0",
50+
"gulp-gzip": "^1.2.0",
51+
"gulp-if": "^2.0.0",
52+
"gulp-imagemin": "^2.4.0",
5353
"gulp-jshint": "^1.8.3",
5454
"gulp-notify": "^2.0.0",
55-
"gulp-protractor": "^1.0.0",
55+
"gulp-protractor": "^2.1.0",
5656
"gulp-rename": "^1.2.0",
5757
"gulp-sass": "^2.0.4",
5858
"gulp-sourcemaps": "^1.6.0",
59-
"gulp-streamify": "0.0.5",
59+
"gulp-streamify": "^1.0.2",
6060
"gulp-uglify": "^1.4.2",
6161
"gulp-util": "^3.0.1",
62-
"imagemin-pngcrush": "^0.1.0",
63-
"isparta": "^3.0.3",
64-
"jshint-stylish": "^1.0.0",
62+
"imagemin-pngcrush": "^4.1.0",
63+
"isparta": "^4.0.0",
64+
"jshint-stylish": "^2.1.0",
6565
"karma": "^0.13.14",
6666
"karma-browserify": "^4.4.0",
6767
"karma-chrome-launcher": "^0.2.1",
6868
"karma-coverage": "douglasduteil/karma-coverage#next",
6969
"karma-firefox-launcher": "^0.1.3",
7070
"karma-jasmine": "^0.3.6",
71-
"pretty-hrtime": "^0.2.2",
72-
"protractor": "^2.5.1",
73-
"run-sequence": "^0.3.6",
71+
"pretty-hrtime": "^1.0.1",
72+
"protractor": "2.5.1",
73+
"run-sequence": "^1.1.5",
7474
"tiny-lr": "0.0.9",
75-
"uglifyify": "^2.5.0",
75+
"uglifyify": "^3.0.1",
7676
"vinyl-buffer": "^1.0.0",
77-
"vinyl-source-stream": "^0.1.1",
77+
"vinyl-source-stream": "^1.1.0",
7878
"watchify": "^3.4.0"
7979
},
8080
"scripts": {
81-
"pretest": "npm install",
8281
"test": "karma start test/karma.conf.js",
83-
"preprotractor": "npm install && webdriver-manager update",
82+
"preprotractor": "webdriver-manager update",
8483
"protractor": "protractor test/protractor.conf.js"
8584
},
8685
"browser": {

test/karma.conf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ module.exports = function(config) {
1919

2020
browserify: {
2121
debug: true,
22-
extensions: ['.js', '.jsx'],
22+
extensions: ['.js'],
2323
transform: [
2424
'babelify',
25+
'browserify-ngannotate',
2526
'bulkify',
2627
istanbul({
2728
instrumenter: isparta,

0 commit comments

Comments
 (0)