Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grunt Up & Running from Using Grunt For A Better Workflow.
'use strict';
var packagejson = require('./package.json');
module.exports = function (grunt) {
// Configuration
grunt.initConfig({
pkg: packagejson,
watch: {
scripts: {
files: ['<%= pkg.name %>.js'],
tasks: ['default']
}
},
jshint: {
build: [
'<%= pkg.name %>.js'
]
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
build: {
src: '<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
}
});
grunt.registerTask('default', [
'jshint',
'uglify'
]);
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
};
npm install -g grunt-cli
npm install grunt-contrib-watch --save-dev
{
"name": "realchaseadams",
"version": "1.0.24",
"description": "Yeoman / Grunt workflow for realchaseadams",
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.5.2",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.5.3"
},
"engines": {
"node": ">=0.8.0"
}
}
(function() {
var foo = "hello ",
bar = "world!";
console.log(foo + bar);
})();
@MartinP7r

This comment has been minimized.

Copy link

@MartinP7r MartinP7r commented Mar 19, 2016

on your site

In our Gruntfile, we’ve very basically told it for jshint, we want to lint the javascript file script.js,

I think you told jshint to lint the file "realchaseadams.js", since your using '<%= pkg.name %>.js' in your Gruntfile.js (as with the other tasks as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment