diff --git a/dist/css/styles.css b/dist/css/styles.css index 4a0f32d..275ff02 100644 --- a/dist/css/styles.css +++ b/dist/css/styles.css @@ -119,7 +119,7 @@ label { } input[type="text"], select { - border: 1px solid #aaaaaa; + border: 1px solid #aaa; border-radius: 4px; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-sizing: border-box; @@ -141,7 +141,7 @@ select { } .address-picklist div, .use-address-entered { - color: #333333; + color: #333; font-size: 14px; line-height: 1.4; padding: 5px 11px; @@ -153,7 +153,7 @@ select { margin-top: -1px; } .use-address-entered:hover { - background: #eeeeee; + background: #eee; } .address-picklist div:first-child:hover, .address-picklist .selected:first-child { @@ -167,7 +167,7 @@ select { } .address-picklist div:hover, .address-picklist .selected { - background: #eeeeee; + background: #eee; border-bottom: 1px solid #015cae; border-top: 1px solid #015cae; padding: 4px 11px; @@ -203,7 +203,7 @@ select { display: block; text-align: center; text-decoration: none; - background-color: #dd1144; + background-color: #d14; color: white; border-radius: 5px; padding: 5px; diff --git a/grunt/options/banner.js b/grunt/options/banner.js new file mode 100644 index 0000000..72392c1 --- /dev/null +++ b/grunt/options/banner.js @@ -0,0 +1,9 @@ +module.exports = function(grunt){ + + // Construct a banner containing package and build information + grunt.config('banner', + '/*! <%= filename %>.js | <%= pkg.url %> | <%= pkg.license %>\n' + + '* <%= pkg.author %> | <%= pkg.contact %> */\n' + //'* Built on <%= timestamp %> */\n', + ); +}; \ No newline at end of file diff --git a/grunt/options/concat.js b/grunt/options/concat.js new file mode 100644 index 0000000..225223c --- /dev/null +++ b/grunt/options/concat.js @@ -0,0 +1,19 @@ +module.exports = function(grunt){ + /** + * Concatenation setup. Concatenated files are built to the path defined by the d variable + * Includes closure banner and footer. Keep these in if you want to wrap concatenated code in closures + */ + grunt.config('concat', { + options: { + banner: '<%= banner %>' + + '\n;(function(window, document, undefined) {\n\n "use strict";\n\n', + footer: '\n})(window, window.document);\n' + }, + dist: { + src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required + dest: '<%= d %>js/<%= filename %>.js' + } + }); + + grunt.loadNpmTasks('grunt-contrib-concat'); +}; \ No newline at end of file diff --git a/grunt/options/copy.js b/grunt/options/copy.js new file mode 100644 index 0000000..e32b37e --- /dev/null +++ b/grunt/options/copy.js @@ -0,0 +1,32 @@ +module.exports = function(grunt){ + + /** + * Copy setup + */ + grunt.config('copy',{ + fonts: { + files: [ + { + expand: true, + flatten: true, + src: ['<%= s %>fonts/**/*'], + dest: '<%= d %>fonts', + filter: 'isFile' + } + ] + }, + images: { + files: [ + { + expand: true, + flatten: true, + src: ['<%= s %>/images/**/*', '!<%= s %>images/**/*.db'], // Include all files in images folder, excluding .db + dest: '<%= d %>images', + filter: 'isFile' + } + ] + } + }); + + grunt.loadNpmTasks('grunt-contrib-copy'); +}; \ No newline at end of file diff --git a/grunt/options/coveralls.js b/grunt/options/coveralls.js new file mode 100644 index 0000000..d3972f1 --- /dev/null +++ b/grunt/options/coveralls.js @@ -0,0 +1,13 @@ +module.exports = function(grunt){ + /** + * Coveralls setup. Tells Coveralls where to find code coverage information + */ + grunt.config('coveralls', { + options: { + force: true + }, + src: 'coverage/lcov.info' + }); + + grunt.loadNpmTasks('grunt-coveralls'); +}; \ No newline at end of file diff --git a/grunt/options/cssmin.js b/grunt/options/cssmin.js new file mode 100644 index 0000000..ed2f805 --- /dev/null +++ b/grunt/options/cssmin.js @@ -0,0 +1,18 @@ +module.exports = function(grunt){ + /** + * CSS min setup + */ + grunt.config('cssmin', { + target: { + files: [{ + expand: true, + cwd: '<%= d %>css', + src: ['*.css', '!*.min.css'], + dest: '<%= d %>css', + ext: '.min.css' + }] + } + }); + + grunt.loadNpmTasks('grunt-contrib-cssmin'); +}; \ No newline at end of file diff --git a/grunt/options/filename.js b/grunt/options/filename.js new file mode 100644 index 0000000..1c0d5a2 --- /dev/null +++ b/grunt/options/filename.js @@ -0,0 +1,3 @@ +module.exports = function(grunt){ + grunt.config('filename', 'contact-data-services'); // Construct a filename from package vars +}; \ No newline at end of file diff --git a/grunt/options/jasmine.js b/grunt/options/jasmine.js new file mode 100644 index 0000000..8b0132d --- /dev/null +++ b/grunt/options/jasmine.js @@ -0,0 +1,29 @@ +module.exports = function(grunt){ + /** + * Jasmine unit test setup. Includes Istanbul code coverage setup with Coveralls-friendly output + */ + grunt.config('jasmine', { + src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required + options: { + specs: '<%= t %>**/*.js', + template: require('grunt-template-jasmine-istanbul'), + templateOptions: { + coverage: 'coverage/coverage.json', + report: [ + { type: 'lcov', options: { dir: 'coverage' }}, // Create .lcov report, required by Coveralls + { type: 'html', options: { dir: 'coverage/html' }}, // Create an html report, readable by humans + { type: 'text-summary' } // Output results to console post-build + ], + thresholds: { + // Test result thresholds all set to 0 to begin with. Commented values are suggestions + lines: 0, // 75 + statements: 0, // 75 + branches: 0, // 75 + functions: 0 // 75 + } + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-jasmine'); +}; \ No newline at end of file diff --git a/grunt/options/jshint.js b/grunt/options/jshint.js new file mode 100644 index 0000000..0e2243e --- /dev/null +++ b/grunt/options/jshint.js @@ -0,0 +1,16 @@ +module.exports = function(grunt){ + /** + * JSHint static analysis setup + */ + grunt.config('jshint', { + files: ['gruntfile.js', '<%= s %>**/*.js', '<%= t %>**/*.js'], // Analyse this file and all source and test files for errors + options: { + browser: true, // Assume general browser globals + globals: { + predef: ['ContactDataServices'] // Any global variables go here, if required + } + }, + }); + + grunt.loadNpmTasks('grunt-contrib-jshint'); +}; \ No newline at end of file diff --git a/grunt/options/less.js b/grunt/options/less.js new file mode 100644 index 0000000..b595258 --- /dev/null +++ b/grunt/options/less.js @@ -0,0 +1,17 @@ +module.exports = function(grunt){ + /** + * Less setup + */ + grunt.config('less', { + dev: { + options: { + paths: ['<%= s %>less/**/*.less'], // Process all Less files in Less folder + }, + files: { + "<%= d %>css/styles.css": "<%= s %>less/_styles.less" // Build styles.css based on _styles.less + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-less'); +}; \ No newline at end of file diff --git a/grunt/options/paths.js b/grunt/options/paths.js new file mode 100644 index 0000000..dc8a1c4 --- /dev/null +++ b/grunt/options/paths.js @@ -0,0 +1,7 @@ +module.exports = function(grunt){ + + grunt.config('s', 'src/'); // The source directory + grunt.config('d', 'dist/'); // The distributable directory, where built files will end up + grunt.config('t', 'test/'); // The test directory, for unit test files/specs + +}; \ No newline at end of file diff --git a/grunt/options/uglify.js b/grunt/options/uglify.js new file mode 100644 index 0000000..c701a30 --- /dev/null +++ b/grunt/options/uglify.js @@ -0,0 +1,17 @@ +module.exports = function(grunt){ + /** + * Uglification (minification) setup. Uglified files are built to the path defined by the d variable and get a .min suffix + */ + grunt.config('uglify', { + options: { + banner: '<%= banner %>' + }, + dist: { + files: { + '<%= d %>js/<%= filename %>.min.js': ['<%= concat.dist.dest %>'] // Each concatenated file will get an uglified version + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-uglify'); +}; \ No newline at end of file diff --git a/grunt/options/watch.js b/grunt/options/watch.js new file mode 100644 index 0000000..c164608 --- /dev/null +++ b/grunt/options/watch.js @@ -0,0 +1,11 @@ +module.exports = function(grunt){ + /** + * Watch setup. The configured tasks will run when and of the files tested by JSHint are changed + */ + grunt.config('watch', { + files: ['<%= jshint.files %>', '<%= less.dev.options.paths %>'], + tasks: ['jshint', 'jasmine', 'less'] + }); + + grunt.loadNpmTasks('grunt-contrib-watch'); +}; \ No newline at end of file diff --git a/gruntfile.js b/gruntfile.js index 4d7fde0..91e3446 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -1,179 +1,12 @@ module.exports = function(grunt) { - + + // Initialise config. grunt.initConfig({ - - pkg: grunt.file.readJSON('package.json'), // Read in package variable from package.json - - //filename: 'contact-data-services.<%= pkg.version %>', - filename: 'contact-data-services', // Construct a filename from package vars - - timestamp: new Date().toUTCString(), // Get a timestamp for banner comments - - // Construct a banner containing package and build information - banner: '/*! <%= filename %>.js | <%= pkg.url %> | <%= pkg.license %>\n' + - '* <%= pkg.author %> | <%= pkg.contact %> */\n', - //'* Built on <%= timestamp %> */\n', - - s: 'src/', // The source directory - d: 'dist/', // The distributable directory, where built files will end up - t: 'test/', // The test directory, for unit test files/specs - - /** - * Concatenation setup. Concatenated files are built to the path defined by the d variable - * Includes closure banner and footer. Keep these in if you want to wrap concatenated code in closures - */ - concat: { - options: { - banner: '<%= banner %>' + - '\n;(function(window, document, undefined) {\n\n "use strict";\n\n', - footer: '\n})(window, window.document);\n' - }, - dist: { - src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required - dest: '<%= d %>js/<%= filename %>.js' - } - }, - - /** - * Uglification (minification) setup. Uglified files are built to the path defined by the d variable and get a .min suffix - */ - uglify: { - options: { - banner: '<%= banner %>' - }, - dist: { - files: { - '<%= d %>js/<%= filename %>.min.js': ['<%= concat.dist.dest %>'] // Each concatenated file will get an uglified version - } - } - }, - - /** - * Jasmine unit test setup. Includes Istanbul code coverage setup with Coveralls-friendly output - */ - jasmine: { - src: ['<%= s %>js/_scaffolding.js', '<%= s %>js/**/*.js', '<%= s %>js/main-address.js'], // Define specific files in dependency order if required - options: { - specs: '<%= t %>**/*.js', - template: require('grunt-template-jasmine-istanbul'), - templateOptions: { - coverage: 'coverage/coverage.json', - report: [ - { type: 'lcov', options: { dir: 'coverage' }}, // Create .lcov report, required by Coveralls - { type: 'html', options: { dir: 'coverage/html' }}, // Create an html report, readable by humans - { type: 'text-summary' } // Output results to console post-build - ], - thresholds: { - // Test result thresholds all set to 0 to begin with. Commented values are suggestions - lines: 0, // 75 - statements: 0, // 75 - branches: 0, // 75 - functions: 0 // 75 - } - } - } - }, - - /** - * JSHint static analysis setup - */ - jshint: { - files: ['gruntfile.js', '<%= s %>**/*.js', '<%= t %>**/*.js'], // Analyse this file and all source and test files for errors - options: { - browser: true, // Assume general browser globals - globals: { - predef: ['ContactDataServices'] // Any global variables go here, if required - } - } - }, - - /** - * Less setup - */ - less: { - dev: { - options: { - paths: ['<%= s %>less/**/*.less'], // Process all Less files in Less folder - }, - files: { - "<%= d %>css/styles.css": "<%= s %>less/_styles.less" // Build styles.css based on _styles.less - } - } - }, - - /** - * CSS min setup - */ - cssmin: { - target: { - files: [{ - expand: true, - cwd: '<%= d %>css', - src: ['*.css', '!*.min.css'], - dest: '<%= d %>css', - ext: '.min.css' - }] - } - }, - - /** - * Copy setup - */ - copy: { - fonts: { - files: [ - { - expand: true, - flatten: true, - src: ['<%= s %>fonts/**/*'], - dest: '<%= d %>fonts', - filter: 'isFile' - } - ] - }, - images: { - files: [ - { - expand: true, - flatten: true, - src: ['<%= s %>/images/**/*', '!<%= s %>images/**/*.db'], // Include all files in images folder, excluding .db - dest: '<%= d %>images', - filter: 'isFile' - } - ] - } - }, - - /** - * Watch setup. The configured tasks will run when and of the files tested by JSHint are changed - */ - watch: { - files: ['<%= jshint.files %>', '<%= less.dev.options.paths %>'], - tasks: ['jshint', 'jasmine', 'less'] - }, - - /** - * Coveralls setup. Tells Coveralls where to find code coverage information - */ - coveralls: { - options: { - force: true - }, - src: 'coverage/lcov.info' - } - + pkg: grunt.file.readJSON('package.json') }); - // Load tasks in this order - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-copy'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-jasmine'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-less'); - grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-coveralls'); + // Load per-task config from separate files. + grunt.loadTasks('grunt/options'); // Register test and build tasks.These can be run from the command line with "grunt test" or "grunt build" // "grunt watch" should be run while developing to notify you when things go wrong diff --git a/package.json b/package.json index fbb7e26..776c91c 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,12 @@ "grunt-contrib-copy": "^0.8.2", "grunt-contrib-jasmine": "~0.9.1", "grunt-contrib-jshint": "~0.11.0", - "grunt-contrib-less": "~1.0.1", + "grunt-contrib-less": "~1.1.0", "grunt-contrib-cssmin": "~0.14.0", - "grunt-contrib-uglify": "~0.9.2", + "grunt-contrib-uglify": "~0.11.0", "grunt-contrib-watch": "~0.6.1", "grunt-coveralls": "~1.0.0", - "grunt-template-jasmine-istanbul": "~0.3.4" + "grunt-template-jasmine-istanbul": "~0.4.0" }, "scripts": { "test": "grunt test"