Skip to content

Commit 40580b7

Browse files
author
Jeff Harrell
committed
Adding watch task for easier dev
1 parent 17bbd1f commit 40580b7

3 files changed

Lines changed: 28 additions & 17 deletions

File tree

Gruntfile.js

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,61 @@
11
module.exports = function (grunt) {
22

3-
"use strict";
3+
'use strict';
44

55
// Project configuration.
66
grunt.initConfig({
77

8-
pkg: grunt.file.readJSON("package.json"),
8+
pkg: grunt.file.readJSON('package.json'),
99

1010
meta: {
11-
banner: "/*!\n * <%= pkg.name %>\n * <%= pkg.description %>\n * @version <%= pkg.version %> - <%= grunt.template.today(\'yyyy-mm-dd\') %>\n * @author <%= pkg.author.name %> <<%= pkg.author.url %>>\n */\n"
11+
banner: '/*!\n * <%= pkg.name %>\n * <%= pkg.description %>\n * @version <%= pkg.version %> - <%= grunt.template.today(\'yyyy-mm-dd\') %>\n * @author <%= pkg.author.name %> <<%= pkg.author.url %>>\n */\n'
1212
},
1313

1414
jshint: {
1515
all: {
16-
src: ["src/*.js", "test/spec/*.js"],
16+
src: ['src/*.js', 'test/spec/*.js'],
1717
options: {
18-
jshintrc: ".jshintrc"
18+
jshintrc: '.jshintrc'
1919
}
2020
}
2121
},
2222

2323
uglify: {
2424
dist: {
25-
src: [ "<%= meta.banner %>", "src/paypal-button.js" ],
26-
dest: "dist/paypal-button.min.js",
25+
src: ['<%= meta.banner %>', 'src/paypal-button.js'],
26+
dest: 'dist/paypal-button.min.js',
2727
options: {
28-
banner: "<%= meta.banner %>"
28+
banner: '<%= meta.banner %>'
2929
}
3030
}
3131
},
3232

3333
mochaTest: {
3434
all: {
3535
options: {
36-
reporter: "spec"
36+
reporter: 'spec'
3737
},
38-
src: ["test/spec/*.js"]
38+
src: ['test/spec/*.js']
39+
}
40+
},
41+
watch: {
42+
scripts: {
43+
files: ['src/**/*.js'],
44+
tasks: ['build'],
45+
options: {
46+
spawn: false
47+
}
3948
}
4049
}
4150
});
4251

4352
// Load grunt tasks from npm packages
44-
grunt.loadNpmTasks("grunt-contrib-jshint");
45-
grunt.loadNpmTasks("grunt-contrib-uglify");
46-
grunt.loadNpmTasks("grunt-mocha-test");
53+
grunt.loadNpmTasks('grunt-contrib-jshint');
54+
grunt.loadNpmTasks('grunt-contrib-uglify');
55+
grunt.loadNpmTasks('grunt-contrib-watch');
56+
grunt.loadNpmTasks('grunt-mocha-test');
4757

48-
grunt.registerTask("default", ["jshint", "uglify"]);
49-
grunt.registerTask("test", ["jshint", "mochaTest"]);
58+
grunt.registerTask('build', ['jshint', 'uglify']);
59+
grunt.registerTask('test', ['jshint', 'mochaTest']);
5060

5161
};

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
"scripts": {
3232
"test": "grunt test"
3333
},
34-
"dependencies": {},
34+
"dependencies": {
35+
"grunt-contrib-watch": "^0.6.1"
36+
},
3537
"devDependencies": {
3638
"chai": "~1.8.1",
3739
"grunt": "~0.4.2",

src/paypal-button.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ PAYPAL.apps = PAYPAL.apps || {};
177177
// Primary
178178
css += '.paypal-button button { height: 26px; background: #009cde; border: 1px transparent; border-radius: 3px; color: #fff; }';
179179

180-
181180
styleEl.type = 'text/css';
182181
styleEl.id = 'paypal-button';
183182

0 commit comments

Comments
 (0)