Skip to content

Commit 6b10072

Browse files
committed
Grunt Modernizr tasks
1 parent f895bf1 commit 6b10072

17 files changed

+5681
-34
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ css/application.min.*.css
4545
css/styles.min.*.css
4646
js/production.min.*.js
4747
js/scripts.min.*.js
48+
stormbringer-child/*.sass-cache
4849
stormbringer-child/css/application.min.*.css
4950
stormbringer-child/js/styles.min.*.js
5051
stormbringer-child/css/application.min.*.css

Gruntfile.js

+53-18
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
11
module.exports = function(grunt) {
22

3-
// 1. All configuration goes here
43
grunt.initConfig({
54
pkg: grunt.file.readJSON('package.json'),
65

6+
modernizr: {
7+
dist: {
8+
crawl: false,
9+
devFile: false,
10+
uglify: false,
11+
dest: 'js/src/modernizr.js',
12+
options: [
13+
'setClasses',
14+
'addTest',
15+
'testProp',
16+
'fnBind'
17+
],
18+
tests : [
19+
'cookies',
20+
'svg',
21+
'touchevents',
22+
'cssanimations',
23+
'backgroundblendmode',
24+
'backgroundcliptext',
25+
'bgpositionshorthand',
26+
'bgpositionxy',
27+
'backgroundsize',
28+
'bgsizecover',
29+
'borderradius',
30+
'boxshadow',
31+
'flexbox',
32+
'mediaqueries',
33+
'csstransforms',
34+
'cssvhunit',
35+
'cssvwunit'
36+
]
37+
}
38+
},
39+
740
// Clean old files
841
clean: {
942
js: ['js/scripts.min.*.js', '!js/scripts.min.' + grunt.template.today('yyyymm') + '*.js'],
@@ -26,24 +59,19 @@ module.exports = function(grunt) {
2659
}
2760
},
2861

29-
// Combine our javascript files into one
62+
// Combine javascript
3063
concat: {
3164
dist: {
3265
src: [
33-
'js/src/application.js', // Custom JS
66+
'js/src/modernizr.js',
67+
'js/src/common.js',
68+
'js/src/application.js',
3469
],
3570
dest: 'js/scripts.js',
3671
}
3772
},
3873

39-
// Minify javascript
40-
uglify: {
41-
build: {
42-
src: 'js/scripts.js',
43-
dest: 'js/scripts.min.js'
44-
}
45-
},
46-
74+
// Sass compilation
4775
sass: {
4876
dist: {
4977
options: {
@@ -56,6 +84,16 @@ module.exports = function(grunt) {
5684
},
5785

5886

87+
// Minify javascript
88+
uglify: {
89+
build: {
90+
src: 'js/scripts.js',
91+
dest: 'js/scripts.min.js'
92+
}
93+
},
94+
95+
96+
// Minify CSS
5997
cssmin: {
6098
combine: {
6199
files: {
@@ -64,42 +102,39 @@ module.exports = function(grunt) {
64102
}
65103
},
66104

105+
// Watch
67106
watch: {
68107
options: {
69108
livereload : 35729,
70109
},
71-
72110
scripts: {
73111
files: ['js/src/*.js'],
74112
tasks: ['concat', 'uglify', 'clean', 'assets_versioning'],
75113
options: {
76114
spawn: false,
77115
},
78116
},
79-
80117
css: {
81118
files: ['scss/*.scss', 'scss/bootstrap/*.scss', 'scss/helpers/*.scss'],
82119
tasks: ['sass', 'cssmin', 'clean', 'assets_versioning'],
83120
options: {
84121
spawn: false,
85122
}
86123
},
87-
88124
}
89-
90125
});
91126

92-
// 3. Where we tell Grunt we plan to use this plug-in.
93127
grunt.loadNpmTasks('grunt-contrib-concat');
94128
grunt.loadNpmTasks('grunt-contrib-uglify');
95129
grunt.loadNpmTasks('grunt-contrib-sass');
96130
grunt.loadNpmTasks('grunt-contrib-cssmin');
97131
grunt.loadNpmTasks('grunt-contrib-watch');
98132
grunt.loadNpmTasks('grunt-assets-versioning');
99133
grunt.loadNpmTasks('grunt-contrib-clean');
134+
grunt.loadNpmTasks('grunt-modernizr');
100135

101136

102-
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
103-
grunt.registerTask('default', ['concat', 'uglify', 'sass', 'cssmin', 'watch', 'assets_versioning', 'clean']);
137+
// Tasks registration
138+
grunt.registerTask('default', ['modernizr', 'concat', 'uglify', 'sass', 'cssmin', 'watch', 'assets_versioning', 'clean']);
104139

105140
};

css/styles.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/styles.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

functions.php

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
add_theme_support('libraries',
2121
array(
22-
'modernizr' => '2.8.3',
2322
'html5shiv' => '3.7.3',
2423
'respond' => '1.4.2',
2524
'lessjs' => '2.5.0',

inc/front/scripts.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
function stormbringer_js_theme() {
55

6-
wp_enqueue_script( 'stormbringer-common', get_template_directory_uri() . '/js/src/common.js', array( 'jquery' ), null, true );
6+
//wp_enqueue_script( 'stormbringer-common', get_template_directory_uri() . '/js/src/common.js', array( 'jquery' ), null, true );
77

88
// Preprocessor
99
$preprocessor = get_theme_mod('bootstrap_preprocessor', true);
@@ -49,9 +49,9 @@ function stormbringer_js_libraries_footer() {
4949
}
5050
}
5151

52-
if ( @$libraries['modernizr'] && get_theme_mod( 'libraries_modernizr', true ) ) {
52+
/*if ( @$libraries['modernizr'] && get_theme_mod( 'libraries_modernizr', true ) ) {
5353
wp_enqueue_script( 'modernizr', '//cdnjs.cloudflare.com/ajax/libs/modernizr/' . $libraries['modernizr'] . '/modernizr.min.js', array(), null, true );
54-
}
54+
}*/
5555

5656
if(@$libraries['bootstrap'] && get_theme_mod('libraries_bootstrap', true)){
5757
wp_enqueue_script( 'bootstrap', '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/'.$libraries['bootstrap'].'/js/bootstrap.min.js', array(), null, true );

0 commit comments

Comments
 (0)