Skip to content

Commit

Permalink
Create 'cop' grunt task. Similar to rubocop, but for frontend stuff.
Browse files Browse the repository at this point in the history
Validates Bootstrap usage and lints CSS and JS. No easy way to validate our
views or the _generated_ HTML.

Signed-off-by: Anurag Priyam <anurag08priyam@gmail.com>
  • Loading branch information
yeban committed Feb 5, 2015
1 parent 808276a commit 6af84b7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Expand Up @@ -2,6 +2,8 @@ AllCops:
Exclude:
# Because we don't use this test suite at the moment.
- 'spec/ui_test.rb'
# Because these are vendor files.
- 'node_modules/**/*'

Metrics/AbcSize:
Exclude:
Expand Down
32 changes: 32 additions & 0 deletions Gruntfile.js
Expand Up @@ -3,6 +3,32 @@ module.exports = function (grunt) {
pkg: grunt.file.readJSON('package.json'),
prefix: 'public/dist/',
name: '<%= pkg.name.toLowerCase() %>',
//htmllint: {
//options: {
//},
//all: 'views/*'
//},
bootlint: {
options: {
stoponerror: false,
relaxerror: []
},
files: 'views/*'
},
csslint: {
files: 'public/css/custom.css'
},
jshint: {
options: {
force: true
},
files: [
'Gruntfile.js',
'public/js/sequenceserver.js',
'public/js/sequenceserver.blast.js',
'public/js/jquery.t.js',
]
},
cssmin: {
options: {
keepSpecialComments: 0
Expand Down Expand Up @@ -77,10 +103,16 @@ module.exports = function (grunt) {
}
});

//grunt.loadNpmTasks('grunt-html');
grunt.loadNpmTasks('grunt-bootlint');
grunt.loadNpmTasks('grunt-contrib-csslint');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');

//grunt.registerTask('cop', ['htmllint', 'bootlint', 'csslint', 'jshint']);
grunt.registerTask('cop', ['bootlint', 'csslint', 'jshint']);
grunt.registerTask('build', ['cssmin', 'uglify', 'copy', 'compress']);
};
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -13,12 +13,17 @@
"devDependencies": {
"grunt": "0.4.5",
"grunt-cli": "0.1.13",
"grunt-html": "2.0.0",
"grunt-bootlint": "0.7.0",
"grunt-contrib-csslint": "0.4.0",
"grunt-contrib-jshint": "0.11.0",
"grunt-contrib-cssmin": "0.11.0",
"grunt-contrib-uglify": "0.4.0",
"grunt-contrib-copy": "0.7.0",
"grunt-contrib-compress": "0.13.0"
},
"scripts": {
"cop": "grunt cop",
"build": "grunt build"
}
}

0 comments on commit 6af84b7

Please sign in to comment.