Skip to content

Commit f45fc49

Browse files
committed
Added Babel support and updated Gulp for new structure
Also, added JSHint config for ESnext
1 parent fd4e9ce commit f45fc49

File tree

3 files changed

+15
-27
lines changed

3 files changed

+15
-27
lines changed

.jshintrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"esnext": true,
3+
4+
"browser": true
5+
}

gulpfile.js

+8-26
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,15 @@ var gulp = require('gulp'),
77
concat = require('gulp-concat-util'),
88
prefix = require('gulp-autoprefixer'),
99
groupMQ = require('gulp-group-css-media-queries'),
10-
jade = require('gulp-jade');
10+
jade = require('gulp-jade'),
11+
babel = require('gulp-babel');
1112

1213
var paths = {
1314
styles: 'styles/**/*.scss',
1415
scripts: [
15-
'scripts/globals.js',
16-
'scripts/templates.js',
17-
'scripts/model.js',
18-
'scripts/view.js',
19-
'scripts/controller.js',
20-
'scripts/functions.js',
21-
'scripts/actions.js',
22-
'scripts/listeners.js',
23-
'scripts/modules.js',
16+
'scripts/modules/**/*.js',
2417
'scripts/init.js'
2518
],
26-
scriptModules: {
27-
root: 'scripts/modules/**/*.js',
28-
dest: 'scripts'
29-
},
3019
templates: {
3120
root: 'templates/index.jade'
3221
},
@@ -55,21 +44,14 @@ gulp.task('styles', function() {
5544
.pipe(gulp.dest(paths.distribution));
5645
});
5746

58-
gulp.task('scripts-modules', function() {
59-
return gulp.src(paths.scriptModules.root)
60-
.pipe(jshint())
61-
.pipe(jshint.reporter('default'))
62-
.pipe(concat('modules.js'))
63-
.pipe(gulp.dest(paths.scriptModules.dest));
64-
});
65-
66-
gulp.task('scripts', ['scripts-modules'], function() {
47+
gulp.task('scripts', function() {
6748
return gulp.src(paths.scripts)
6849
.pipe(jshint())
6950
.pipe(jshint.reporter('default'))
70-
.pipe(concat('app.js'))
71-
.pipe(concat.header('(function(win) {\n\'use strict\';\n\n'))
72-
.pipe(concat.footer('\n})(window);'))
51+
.pipe(babel())
52+
.pipe(concat('app.js', {process: function(src) { return (src.trim() + '\n').replace(/(^|\n)[ \t]*('use strict'|"use strict");?\s*/g, '$1'); }}))
53+
.pipe(concat.header('(function() {\n\'use strict\';\n'))
54+
.pipe(concat.footer('\n})();'))
7355
.pipe(gulp.dest(paths.distribution))
7456
.pipe(uglify({
7557
mangle: false,

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"gulp-watch": "^0.6.8",
2525
"gulp-concat-util": "~0.5.1",
2626
"gulp-group-css-media-queries": "~1.0.1",
27-
"gulp-jade": "~0.11.0"
27+
"gulp-jade": "~0.11.0",
28+
"gulp-babel": "~4.0.0"
2829
},
2930
"scripts": {
3031
"start": "gulp dev"

0 commit comments

Comments
 (0)