Closed theGeekPirate closed 11 years ago
Still doesn't seem to be working =(
Tested by saving one of the files that "grunt-contrib-watch" was watching, and the rest of the plugins run, but grunt-sloc does not.
Cheers!
Can I show your Gruntfile.js or Project? And error log.
module.exports = function(grunt) {
'use strict';
//load tasks from the npm modules
grunt.loadNpmTasks('grunt-sloc'),
grunt.loadNpmTasks('grunt-contrib-clean'),
grunt.loadNpmTasks('grunt-contrib-concat'),
grunt.loadNpmTasks('grunt-contrib-compress'),
grunt.loadNpmTasks('grunt-jslint'),
grunt.loadNpmTasks('grunt-contrib-watch'),
grunt.initConfig({
//read package.json so the key values can be used if needed
pkg: grunt.file.readJSON("package.json"),
//deletes everything from the build folder, so we start fresh
clean: {
buildFolder: ['build']
},
//counts the lines of code
sloc: {
server: {
files: {
'./': ['Gruntfile.js', 'server.js', 'server/**.js'],
/*'server': ['**.js']*/
}
},
client: {
files: {
'client': ['js/app/**.js','views/**.js']
}
},
tests: {
files: {
'tests': ['**.js']
}
}
},
//concatenates the CSS and JS files into a single file
concat: {
js: {
src: [
'client/js/libs/**.js',
'client/js/app/**.js',
],
dest: 'build/app.js'
},
css: {
src: ['client/css/normalize.css', 'client/css/**/*.css'],
dest: 'build/app.css'
}
},
//compresses all of the server files for easy modulus.io uploading
compress: {
website: {
options: {
archive: 'build/modulus.zip'
},
files: [
{ src: ['server/**', 'package.json', 'server.js'], dest: '' },
]
}
},
//runs jslint
jslint: { // configure the task
files: [ // some example files
'client/js/app/**.js',
'server/**/*.js',
'server.js',
],
exclude: ['server/karma.conf.js'],
directives: {
browser: true, //standard browser globals should be predefined //TODO: Create another task for running client .js vs server .js
unparam: true, //warnings should not be given for unused parameters
todo: true, //allow TODO comments
node: true, //TODO: Create another task for running client .js vs server .js
white: true, //avoid messages about whitespace ("I do what I want!" - Cartman)
indent: 4, //4 spaces per indentation
devel: true, //allow console.log, alert, etc. //TODO: Separate development and production builds
nomen: true, //allow underscores in the beginning of function names
regexp: true, //tolerate . and [^...]. in /RegExp/
predef: [ // array of pre-defined globals
//'jQuery'
]
},
options: {
errorsOnly: true, // only display errors
failOnError: false, // defaults to true
shebang: true, // ignore shebang lines
//junit: 'out/junit.xml', // write the output to a JUnit XML
//log: 'out/lint.log',
//jslintXml: 'out/jslint_xml.xml',
//checkstyle: 'out/checkstyle.xml' // write a checkstyle-XML
}
},
watch: {
scripts: {
files: [
'!node_modules/**',
'!build/**',
'client/**',
'server/**',
'server.js',
'tests/**'
],
tasks: [
'jslint',
'clean',
'concat',
'compress'
],
options: {
}
}
}
});
//setup the workflow
grunt.registerTask('default', ['sloc', 'jslint', 'clean', 'concat', 'compress', 'watch']);
};
Oh whoops, I found my issue, sorry about that!
Forgot to include 'sloc' in the watch tasks, this is what I get for being a newbie blush
Yep!! :-)
Using watch then changing a file, sloc doesn't output the results again.