Load Modernizr from Bower, lean build with Grunt

This commit is contained in:
Ben Word
2014-02-04 23:13:33 -06:00
parent 6ace5bbb27
commit d8cbdb251a
6 changed files with 33 additions and 12 deletions

View File

@@ -65,6 +65,18 @@ module.exports = function(grunt) {
jsHandle: 'roots_scripts' jsHandle: 'roots_scripts'
} }
}, },
modernizr: {
dist: {
devFile: 'assets/vendor/modernizr/modernizr.js',
outputFile: 'assets/js/vendor/modernizr.min.js',
files: [
['assets/js/scripts.min.js'],
['assets/css/main.min.css']
],
uglify: true,
parseFiles: false
}
},
watch: { watch: {
less: { less: {
files: [ files: [
@@ -107,6 +119,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-wp-version'); grunt.loadNpmTasks('grunt-wp-version');
grunt.loadNpmTasks('grunt-modernizr');
// Register tasks // Register tasks
grunt.registerTask('default', [ grunt.registerTask('default', [
@@ -118,5 +131,9 @@ module.exports = function(grunt) {
grunt.registerTask('dev', [ grunt.registerTask('dev', [
'watch' 'watch'
]); ]);
grunt.registerTask('build', [
'default',
'modernizr'
]);
}; };

File diff suppressed because one or more lines are too long

4
assets/js/vendor/modernizr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -13,6 +13,7 @@
"assets/vendor" "assets/vendor"
], ],
"dependencies": { "dependencies": {
"modernizr": "2.7.0",
"jquery": "1.11.0", "jquery": "1.11.0",
"bootstrap": "3.1.0" "bootstrap": "3.1.0"
} }

View File

@@ -7,7 +7,7 @@
* *
* Enqueue scripts in the following order: * Enqueue scripts in the following order:
* 1. jquery-1.11.0.min.js via Google CDN * 1. jquery-1.11.0.min.js via Google CDN
* 2. /theme/assets/js/vendor/modernizr-2.7.0.min.js * 2. /theme/assets/js/vendor/modernizr.min.js
* 3. /theme/assets/js/main.min.js (in footer) * 3. /theme/assets/js/main.min.js (in footer)
*/ */
function roots_scripts() { function roots_scripts() {
@@ -26,7 +26,7 @@ function roots_scripts() {
wp_enqueue_script('comment-reply'); wp_enqueue_script('comment-reply');
} }
wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.7.0.min.js', array(), null, false); wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr.min.js', array(), null, false);
wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', array(), '0fc6af96786d8f267c8686338a34cd38', true); wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', array(), '0fc6af96786d8f267c8686338a34cd38', true);
wp_enqueue_script('modernizr'); wp_enqueue_script('modernizr');
wp_enqueue_script('jquery'); wp_enqueue_script('jquery');

View File

@@ -8,12 +8,14 @@
"url": "git://github.com/roots/roots.git" "url": "git://github.com/roots/roots.git"
}, },
"bugs": { "bugs": {
"url" : "https://github.com/roots/roots/issues" "url": "https://github.com/roots/roots/issues"
}, },
"licenses": [{ "licenses": [
"type": "MIT", {
"url": "http://opensource.org/licenses/MIT" "type": "MIT",
}], "url": "http://opensource.org/licenses/MIT"
}
],
"engines": { "engines": {
"node": ">= 0.10.0" "node": ">= 0.10.0"
}, },
@@ -24,6 +26,7 @@
"grunt-contrib-uglify": "~0.2.4", "grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-watch": "~0.5.3", "grunt-contrib-watch": "~0.5.3",
"grunt-contrib-less": "~0.8.1", "grunt-contrib-less": "~0.8.1",
"grunt-wp-version": "~0.1.0" "grunt-wp-version": "~0.1.0",
"grunt-modernizr": "~0.5.1"
} }
} }