Skip to content

Commit

Permalink
feat(app): improve Gruntfile.js file globbing
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcody committed Jul 17, 2015
1 parent 40800f1 commit 5874dfd
Showing 1 changed file with 31 additions and 85 deletions.
116 changes: 31 additions & 85 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,98 +57,77 @@ module.exports = function (grunt) {
watch: {
injectJS: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.js',
'!<%%= yeoman.client %>/{app,components}/**/*.spec.js',
'!<%%= yeoman.client %>/{app,components}/**/*.mock.js',
'!<%%= yeoman.client %>/app/app.js'],
'<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js',
'!<%%= yeoman.client %>/app/app.js'
],
tasks: [<% if(filters.babel) { %>'newer:babel:client', <% } %>'injector:scripts']
},
injectCss: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.css'
],
files: ['<%%= yeoman.client %>/{app,components}/**/*.css'],
tasks: ['injector:css']
},
mochaTest: {
files: ['server/**/*.spec.js'],
tasks: ['env:test', 'mochaTest']
},
jsTest: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.spec.js',
'<%%= yeoman.client %>/{app,components}/**/*.mock.js'
],
files: ['<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js'],
tasks: ['newer:jshint:all', 'karma']
},<% if (filters.stylus) { %>
injectStylus: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.styl'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.styl'],
tasks: ['injector:stylus']
},
stylus: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.styl'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.styl'],
tasks: ['stylus', 'autoprefixer']
},<% } if (filters.sass) { %>
injectSass: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'],
tasks: ['injector:sass']
},
sass: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}'],
tasks: ['sass', 'autoprefixer']
},<% } if (filters.less) { %>
injectLess: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.less'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.less'],
tasks: ['injector:less']
},
less: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.less'],
files: ['<%%= yeoman.client %>/{app,components}/**/*.less'],
tasks: ['less', 'autoprefixer']
},<% } if (filters.jade) { %>
jade: {
files: [
'<%%= yeoman.client %>/{app,components}/*',
'<%%= yeoman.client %>/{app,components}/**/*.jade'],
'<%%= yeoman.client %>/{app,components}/**/*.jade'
],
tasks: ['jade']
},<% } if (filters.coffee) { %>
coffee: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.{coffee,litcoffee,coffee.md}',
'!<%%= yeoman.client %>/{app,components}/**/*.spec.{coffee,litcoffee,coffee.md}'
],
files: ['<%%= yeoman.client %>/{app,components}/**/!(*.spec).{coffee,litcoffee,coffee.md}'],
tasks: ['newer:coffee', 'injector:scripts']
},
coffeeTest: {
files: [
'<%%= yeoman.client %>/{app,components}/**/*.spec.{coffee,litcoffee,coffee.md}'
],
files: ['<%%= yeoman.client %>/{app,components}/**/*.spec.{coffee,litcoffee,coffee.md}'],
tasks: ['karma']
},<% } %>
gruntfile: {
files: ['Gruntfile.js']
},
livereload: {
files: [
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.css',
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.html',
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.js',
'!{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.spec.js',
'!{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.mock.js',
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.{css,html}',
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/!(*.spec|*.mock).js',
'<%%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
],
options: {
livereload: true
}
},
express: {
files: [
'server/**/*.{js,json}'
],
files: ['server/**/*.{js,json}'],
tasks: ['express:dev', 'wait'],
options: {
livereload: true,
Expand All @@ -167,27 +146,17 @@ module.exports = function (grunt) {
options: {
jshintrc: 'server/.jshintrc'
},
src: [
'server/**/*.js',
'!server/**/*.{spec,integration}.js'
]
src: ['server/**/!(*.spec|*.integration).js']
},
serverTest: {
options: {
jshintrc: 'server/.jshintrc-spec'
},
src: ['server/**/*.{spec,integration}.js']
},
all: [
'<%%= yeoman.client %>/{app,components}/**/*.js',
'!<%%= yeoman.client %>/{app,components}/**/*.spec.js',
'!<%%= yeoman.client %>/{app,components}/**/*.mock.js'
],
all: ['<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js'],
test: {
src: [
'<%%= yeoman.client %>/{app,components}/**/*.spec.js',
'<%%= yeoman.client %>/{app,components}/**/*.mock.js'
]
src: ['<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js']
}
},

Expand All @@ -198,7 +167,6 @@ module.exports = function (grunt) {
main: {
files: {
src: [
'<%%= yeoman.client %>/app/**/*.js',
'<%%= yeoman.client %>/app/**/*.js',
'server/**/*.js'
]
Expand All @@ -213,10 +181,7 @@ module.exports = function (grunt) {
dot: true,
src: [
'.tmp',
'<%%= yeoman.dist %>/*',
'!<%%= yeoman.dist %>/.git*',
'!<%%= yeoman.dist %>/.openshift',
'!<%%= yeoman.dist %>/Procfile'
'<%%= yeoman.dist %>/**/!(.git*|.openshift|Procfile)'
]
}]
},
Expand Down Expand Up @@ -285,8 +250,7 @@ module.exports = function (grunt) {
filerev: {
dist: {
src: [
'<%%= yeoman.dist %>/client/!(bower_components)/{,*/}*.js',
'<%%= yeoman.dist %>/client/!(bower_components)/{,*/}*.css',
'<%%= yeoman.dist %>/client/!(bower_components)/{,*/}*.{js,css}',
'<%%= yeoman.dist %>/client/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%%= yeoman.dist %>/client/assets/fonts/*'
]
Expand Down Expand Up @@ -516,11 +480,7 @@ module.exports = function (grunt) {
mocha_istanbul: {
unit: {
options: {
excludes: [
'**/*.spec.js',
'**/*.mock.js',
'**/*.integration.js'
],
excludes: ['**/*.{spec,mock,integration}.js'],
reporter: 'spec',
require: ['mocha.conf.js'],
mask: '**/*.spec.js',
Expand All @@ -530,11 +490,7 @@ module.exports = function (grunt) {
},
integration: {
options: {
excludes: [
'**/*.spec.js',
'**/*.mock.js',
'**/*.integration.js'
],
excludes: ['**/*.{spec,mock,integration}.js'],
reporter: 'spec',
require: ['mocha.conf.js'],
mask: '**/*.integration.js',
Expand Down Expand Up @@ -592,9 +548,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
cwd: '<%%= yeoman.client %>',
src: [
'{app,components}/**/*.jade'
],
src: ['{app,components}/**/*.jade'],
dest: '.tmp',
ext: '.html'
}]
Expand All @@ -611,10 +565,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
cwd: 'client',
src: [
'{app,components}/**/*.coffee',
'!{app,components}/**/*.spec.coffee'
],
src: ['{app,components}/**/!(*.spec).coffee'],
dest: '.tmp',
ext: '.js'
}]
Expand All @@ -630,10 +581,7 @@ module.exports = function (grunt) {
files: [{
expand: true,
cwd: '<%%= yeoman.client %>',
src: [
'{app,components}/**/*.js',
'!{app,components}/**/*.spec.js'
],
src: ['{app,components}/**/!(*.spec).js'],
dest: '.tmp'
}]
}
Expand Down Expand Up @@ -707,11 +655,9 @@ module.exports = function (grunt) {
files: {
'<%%= yeoman.client %>/index.html': [
[<% if(filters.babel) { %>
'.tmp/{app,components}/**/*.js',<% } else { %>
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.js',<% } %>
'!{.tmp,<%%= yeoman.client %>}/app/app.js',
'!{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.spec.js',
'!{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.mock.js'
'.tmp/{app,components}/**/!(*.spec|*.mock).js',<% } else { %>
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/!(*.spec|*.mock).js',<% } %>
'!{.tmp,<%%= yeoman.client %>}/app/app.js'
]
]
}
Expand Down

0 comments on commit 5874dfd

Please sign in to comment.