-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
170 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
'use strict'; | ||
|
||
require('./tasks/build/build'); | ||
require('./tasks/build'); | ||
require('./tasks/start'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
'use strict'; | ||
|
||
var pathUtil = require('path'); | ||
var gulp = require('gulp'); | ||
var less = require('gulp-less'); | ||
var watch = require('gulp-watch'); | ||
var batch = require('gulp-batch'); | ||
var plumber = require('gulp-plumber'); | ||
var jetpack = require('fs-jetpack'); | ||
|
||
var bundle = require('./bundle'); | ||
var generateSpecsEntryFile = require('./generate_specs_entry_file'); | ||
var utils = require('./utils'); | ||
|
||
var projectDir = jetpack; | ||
var srcDir = projectDir.cwd('./src'); | ||
var destDir = projectDir.cwd('./app'); | ||
|
||
// ------------------------------------- | ||
// Tasks | ||
// ------------------------------------- | ||
|
||
var bundleApplication = function () { | ||
return Promise.all([ | ||
bundle(srcDir.path('background.js'), destDir.path('background.js')), | ||
bundle(srcDir.path('app.js'), destDir.path('app.js')), | ||
]); | ||
}; | ||
|
||
var bundleSpecs = function () { | ||
return generateSpecsEntryFile().then(function (specEntryPointPath) { | ||
return bundle(specEntryPointPath, destDir.path('app.js')); | ||
}); | ||
}; | ||
|
||
gulp.task('bundle', function () { | ||
if (utils.getEnvName() === 'test') { | ||
return bundleSpecs(); | ||
} | ||
return bundleApplication(); | ||
}); | ||
|
||
gulp.task('less', function () { | ||
return gulp.src(srcDir.path('stylesheets/main.less')) | ||
.pipe(plumber()) | ||
.pipe(less()) | ||
.pipe(gulp.dest(destDir.path('stylesheets'))); | ||
}); | ||
|
||
gulp.task('environment', function () { | ||
var configFile = 'config/env_' + utils.getEnvName() + '.json'; | ||
projectDir.copy(configFile, destDir.path('env.json'), { overwrite: true }); | ||
}); | ||
|
||
gulp.task('watch', function () { | ||
var beepOnError = function (done) { | ||
return function (err) { | ||
if (err) { | ||
utils.beepSound(); | ||
} | ||
done(err); | ||
}; | ||
}; | ||
|
||
watch('src/**/*.js', batch(function (events, done) { | ||
gulp.start('bundle', beepOnError(done)); | ||
})); | ||
watch('src/**/*.less', batch(function (events, done) { | ||
gulp.start('less', beepOnError(done)); | ||
})); | ||
}); | ||
|
||
gulp.task('build', ['bundle', 'less', 'environment']); |
Oops, something went wrong.