Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Split tasks used by gruntfile into separate files
Browse files Browse the repository at this point in the history
Also, updated some dev dependencies
  • Loading branch information
jbate committed Nov 25, 2015
1 parent f34954c commit 65bb9a8
Show file tree
Hide file tree
Showing 15 changed files with 204 additions and 180 deletions.
10 changes: 5 additions & 5 deletions dist/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions grunt/options/banner.js
Original file line number Diff line number Diff line change
@@ -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',
);
};
19 changes: 19 additions & 0 deletions grunt/options/concat.js
Original file line number Diff line number Diff line change
@@ -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');
};
32 changes: 32 additions & 0 deletions grunt/options/copy.js
Original file line number Diff line number Diff line change
@@ -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');
};
13 changes: 13 additions & 0 deletions grunt/options/coveralls.js
Original file line number Diff line number Diff line change
@@ -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');
};
18 changes: 18 additions & 0 deletions grunt/options/cssmin.js
Original file line number Diff line number Diff line change
@@ -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');
};
3 changes: 3 additions & 0 deletions grunt/options/filename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(grunt){
grunt.config('filename', 'contact-data-services'); // Construct a filename from package vars
};
29 changes: 29 additions & 0 deletions grunt/options/jasmine.js
Original file line number Diff line number Diff line change
@@ -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');
};
16 changes: 16 additions & 0 deletions grunt/options/jshint.js
Original file line number Diff line number Diff line change
@@ -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');
};
17 changes: 17 additions & 0 deletions grunt/options/less.js
Original file line number Diff line number Diff line change
@@ -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');
};
7 changes: 7 additions & 0 deletions grunt/options/paths.js
Original file line number Diff line number Diff line change
@@ -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

};
17 changes: 17 additions & 0 deletions grunt/options/uglify.js
Original file line number Diff line number Diff line change
@@ -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');
};
11 changes: 11 additions & 0 deletions grunt/options/watch.js
Original file line number Diff line number Diff line change
@@ -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');
};
Loading

0 comments on commit 65bb9a8

Please sign in to comment.