Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #666 from Gym/task-enhancements
Browse files Browse the repository at this point in the history
Grunt and Gulp task enhancements
  • Loading branch information
ilanbiala committed Jul 24, 2015
2 parents 0369db4 + 3e378b4 commit 3a39f0a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 3 additions & 1 deletion config/assets/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ module.exports = {
views: ['modules/*/client/views/**/*.html']
},
server: {
allJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'modules/*/server/**/*.js'],
gruntConfig: 'gruntfile.js',
gulpConfig: 'gulpfile.js',
allJS: ['server.js', 'config/**/*.js', 'modules/*/server/**/*.js'],
models: 'modules/*/server/models/**/*.js',
routes: ['modules/!(core)/server/routes/**/*.js', 'modules/core/server/routes/**/*.js'],
sockets: 'modules/*/server/sockets/**/*.js',
Expand Down
6 changes: 3 additions & 3 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function (grunt) {
}
},
serverJS: {
files: defaultAssets.server.allJS,
files: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS),
tasks: ['jshint'],
options: {
livereload: true
Expand Down Expand Up @@ -78,7 +78,7 @@ module.exports = function (grunt) {
options: {
nodeArgs: ['--debug'],
ext: 'js,html',
watch: _.union(defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
watch: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.views, defaultAssets.server.allJS, defaultAssets.server.config)
}
}
},
Expand All @@ -91,7 +91,7 @@ module.exports = function (grunt) {
},
jshint: {
all: {
src: _.union(defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e),
src: _.union(defaultAssets.server.gruntConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e),
options: {
jshintrc: true,
node: true,
Expand Down
14 changes: 8 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ var _ = require('lodash'),
gulp = require('gulp'),
gulpLoadPlugins = require('gulp-load-plugins'),
runSequence = require('run-sequence'),
plugins = gulpLoadPlugins();
plugins = gulpLoadPlugins(),
path = require('path');

// Set NODE_ENV to 'test'
gulp.task('env:test', function () {
Expand Down Expand Up @@ -42,6 +43,7 @@ gulp.task('watch', function() {
plugins.livereload.listen();

// Add watch rules
gulp.watch(defaultAssets.server.gulpConfig, ['jshint']);
gulp.watch(defaultAssets.server.views).on('change', plugins.livereload.changed);
gulp.watch(defaultAssets.server.allJS, ['jshint']).on('change', plugins.livereload.changed);
gulp.watch(defaultAssets.client.views).on('change', plugins.livereload.changed);
Expand All @@ -65,7 +67,7 @@ gulp.task('csslint', function (done) {

// JS linting task
gulp.task('jshint', function () {
return gulp.src(_.union(defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e))
return gulp.src(_.union(defaultAssets.server.gulpConfig, defaultAssets.server.allJS, defaultAssets.client.js, testAssets.tests.server, testAssets.tests.client, testAssets.tests.e2e))
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('default'))
.pipe(plugins.jshint.reporter('fail'));
Expand Down Expand Up @@ -95,8 +97,8 @@ gulp.task('cssmin', function () {
gulp.task('sass', function () {
return gulp.src(defaultAssets.client.sass)
.pipe(plugins.sass())
.pipe(plugins.rename(function (path) {
path.dirname = path.dirname.replace('/scss', '/css');
.pipe(plugins.rename(function (file) {
file.dirname = file.dirname.replace(path.sep + 'scss', path.sep + 'css');
}))
.pipe(gulp.dest('./modules/'));
});
Expand All @@ -105,8 +107,8 @@ gulp.task('sass', function () {
gulp.task('less', function () {
return gulp.src(defaultAssets.client.less)
.pipe(plugins.less())
.pipe(plugins.rename(function (path) {
path.dirname = path.dirname.replace('/less', '/css');
.pipe(plugins.rename(function (file) {
file.dirname = file.dirname.replace(path.sep + 'less', path.sep + 'css');
}))
.pipe(gulp.dest('./modules/'));
});
Expand Down

0 comments on commit 3a39f0a

Please sign in to comment.