Grunt : add JSHint
This commit is contained in:
@@ -41,11 +41,13 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('c', [
|
||||
'csscomb'
|
||||
]);
|
||||
grunt.registerTask('j', [
|
||||
'jshint'
|
||||
]);
|
||||
grunt.registerTask('wlint', [
|
||||
// PHP
|
||||
'phplint',
|
||||
'jsonlint',
|
||||
|
||||
// Utilities
|
||||
'watch'
|
||||
]);
|
||||
|
||||
@@ -4,42 +4,41 @@ var app = window.app || {};
|
||||
// Initialize app
|
||||
app.init = function(){
|
||||
|
||||
'use strict';
|
||||
'use strict';
|
||||
|
||||
var self = this;
|
||||
var self = this;
|
||||
|
||||
self.params = {
|
||||
self.params = {
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
self.elements = {
|
||||
html : document.documentElement,
|
||||
body : document.body
|
||||
};
|
||||
self.elements = {
|
||||
html : document.documentElement,
|
||||
body : document.body
|
||||
};
|
||||
|
||||
// Init as empty and / or build
|
||||
self.templates = self.templates || {};
|
||||
// Init as empty and / or build
|
||||
self.templates = self.templates || {};
|
||||
|
||||
/* Template scripts pseudo loader
|
||||
========================================================================== */
|
||||
/* Template scripts pseudo loader
|
||||
========================================================================== */
|
||||
|
||||
// Identify the template we're using
|
||||
self.params.current_template = self.elements.body.getAttribute('data-template');
|
||||
// Identify the template we're using
|
||||
self.params.current_template = self.elements.body.getAttribute('data-template');
|
||||
|
||||
// Run the template script only if it's found
|
||||
if( typeof self.templates[ self.params.current_template ] === 'object' ){
|
||||
self.templates[ self.params.current_template ].init();
|
||||
}
|
||||
|
||||
/* Execute global site scripts
|
||||
========================================================================== */
|
||||
if( typeof self.Globals === 'object' ){
|
||||
self.Globals.init();
|
||||
}
|
||||
// Run the template script only if it's found
|
||||
if( typeof self.templates[ self.params.current_template ] === 'object' ){
|
||||
self.templates[ self.params.current_template ].init();
|
||||
}
|
||||
|
||||
/* Execute global site scripts
|
||||
========================================================================== */
|
||||
if( typeof self.Globals === 'object' ){
|
||||
self.Globals.init();
|
||||
}
|
||||
};
|
||||
|
||||
// On doc ready, init your app
|
||||
$(function(){
|
||||
app.init();
|
||||
});
|
||||
app.init();
|
||||
});
|
||||
|
||||
@@ -6,17 +6,14 @@ app.Globals = {
|
||||
|
||||
'use strict';
|
||||
|
||||
var self = this;
|
||||
//var self = this;
|
||||
|
||||
/* Site wide binds go here
|
||||
========================================================================== */
|
||||
if( $('.js-boilerplate-toggle').length ){
|
||||
|
||||
$('.js-boilerplate-toggle').on('click',function(event) {
|
||||
// toggle toggle
|
||||
});
|
||||
|
||||
}
|
||||
$('.js-boilerplate-toggle').on('click',function() {
|
||||
// toggle toggle
|
||||
});
|
||||
|
||||
/* When all content has loaded, not just DOM
|
||||
========================================================================== */
|
||||
@@ -26,4 +23,4 @@ app.Globals = {
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@ app.templates.generic = {
|
||||
init:function(){
|
||||
|
||||
// Template specific code
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
0
www/modules/boilerplate/assets/scripts/src/vendors/.gitkeep
vendored
Normal file
0
www/modules/boilerplate/assets/scripts/src/vendors/.gitkeep
vendored
Normal file
19
www/modules/boilerplate/grunt_tasks/jshint.js
Normal file
19
www/modules/boilerplate/grunt_tasks/jshint.js
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
options: {
|
||||
"curly":true,
|
||||
"eqeqeq": true,
|
||||
"eqnull": true,
|
||||
"undef":true,
|
||||
"unused": true,
|
||||
browser:true,
|
||||
"globals":{
|
||||
"window":true,
|
||||
"$":true,
|
||||
"jQuery":true
|
||||
}
|
||||
},
|
||||
src: [
|
||||
'assets/scripts/src/**/*.js',
|
||||
'!assets/scripts/src/vendors/**/*.js'
|
||||
],
|
||||
}
|
||||
@@ -11,6 +11,12 @@ module.exports = {
|
||||
message: 'Sass compiled to CSS.'
|
||||
}
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
// title: '<%= pkg.title %>',
|
||||
message: 'Sass compiled to CSS.'
|
||||
}
|
||||
},
|
||||
concat: {
|
||||
options: {
|
||||
// title: '<%= pkg.title %>',
|
||||
@@ -23,4 +29,4 @@ module.exports = {
|
||||
message: 'SVG is now concatenated'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"grunt-browser-sync": "0.0.0",
|
||||
"grunt-contrib-concat": "0.0.0",
|
||||
"grunt-contrib-cssmin": "0.0.0",
|
||||
"grunt-contrib-jshint": "0.0.0",
|
||||
"grunt-contrib-uglify": "0.0.0",
|
||||
"grunt-contrib-watch": "0.0.0",
|
||||
"grunt-csscomb": "0.0.0",
|
||||
|
||||
Reference in New Issue
Block a user