diff --git a/.gitignore b/.gitignore index 76fa0ba..243bbcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ npm-debug.log .sass-cache -node_modules \ No newline at end of file +node_modules +bower_components \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 14d66a0..dc56ecd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,6 +5,7 @@ module.exports = function(grunt) { }; grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), autoprefixer: { single_file: { options: { @@ -13,6 +14,9 @@ module.exports = function(grunt) { files: { 'style.css': 'style.css' } } }, + browserify: { + 'js/script.js': ['js/main.js'] + }, imageoptim: { src: [paths.img], options: { @@ -52,11 +56,11 @@ module.exports = function(grunt) { } }, jshint: { - all: ['js/script.js'] + all: ['js/main.js'] }, uglify: { all: { - files: { 'script.js': 'script.js' } + files: { 'js/script.js': 'js/script.js' } } }, watch: { @@ -68,13 +72,14 @@ module.exports = function(grunt) { } }, js: { - files: ['js/*.js'], - tasks: ['uglify', 'jshint'] + files: ['js/main.js'], + tasks: ['browserify', 'jshint', 'uglify'] } } }); grunt.loadNpmTasks('grunt-autoprefixer'); + grunt.loadNpmTasks('grunt-browserify'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-uglify'); @@ -83,6 +88,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-svg2png'); grunt.loadNpmTasks('grunt-svgmin'); - grunt.registerTask('default', ['imageoptim', 'svgmin', 'svg2png', 'watch']); + grunt.registerTask('default', ['sass', 'browserify', 'jshint', 'uglify', 'watch']); }; diff --git a/README.md b/README.md index 3854589..97f559b 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,15 @@ A lightweight and skeletal WordPress boilerplate theme for HTML5 and beyond. The * Customised functions.php adding theme support for high customisation * Minimised HTTP requests for high Web Performance * Localised strings for multiple language support -* Grunt.js integration - automatic image optimisation, Sass compiling and watching, css minification and live reload support +* Grunt integration - automatic image optimisation, Sass compiling and watching, css minification and live reload support ## Installation ### Dependencies -* Node.js -* Grunt.js +* [Node.js](http://nodejs.org) +* [Grunt](http://gruntjs.com) +* [Browserify](http://browserify.org) #### Optional @@ -31,7 +32,13 @@ Clone/download the barebones repositories into your WordPress /wp-content/themes $ npm install -Then run `grunt`: +Then run `grunt` to execute the default tasks: compiling sass/js and creating the watcher. + +To aid performance, the image-centric tasks aren't run by default and can be executed by running: + + $ grunt svgmin + $ grunt svg2png + $ grunt imageoptim ## WordPress Support @@ -50,3 +57,4 @@ Compatible with WordPress 3.2 and above, but always use the latest version. * ~~Organisation of Sass folders~~ * ~~Simple grid framework~~ +* ~~Organisation of JS~~ \ No newline at end of file diff --git a/functions.php b/functions.php index 0c72daa..a02059d 100644 --- a/functions.php +++ b/functions.php @@ -37,13 +37,15 @@ add_filter( 'post_comments_feed_link', 'barebones_remove_comments_rss' ); */ function barebones_scripts() { - // If you need 'em - // wp_enqueue_style( 'fonts', '//fonts.googleapis.com/css?family=Font+Family' ); - // wp_enqueue_style( 'icons', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' ); + /* + * For IE8 to play nice, you'll need to include your CSS here, for example: + * + * wp_enqueue_style( 'fonts', '//fonts.googleapis.com/css?family=Font+Family' ); + * wp_enqueue_style( 'icons', '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' ); + */ wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js', false, '1.11.1', true ); wp_enqueue_script( 'jquery' ); - wp_enqueue_script( 'bxSlider', get_stylesheet_directory_uri() . '/js/jquery.bxslider.min.js', array( 'jquery' ), null, true ); wp_enqueue_script( 'script', get_stylesheet_directory_uri() . '/js/script.js', array( 'jquery' ), null, true ); } diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..1a7aaec --- /dev/null +++ b/js/main.js @@ -0,0 +1,5 @@ +/* + * Require all your other JS files here, for example: + * + * var slider = require('./slider'); + */ \ No newline at end of file diff --git a/js/script.js b/js/script.js index 196e7fa..e69de29 100644 --- a/js/script.js +++ b/js/script.js @@ -1,5 +0,0 @@ -$(function() { - - - -}); \ No newline at end of file diff --git a/package.json b/package.json index 3d4170f..6afa031 100755 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "grunt-svgmin": "~0.4.0", "grunt-contrib-uglify": "~0.5.0", "grunt-contrib-jshint": "~0.10.0", - "grunt-autoprefixer": "~0.8.2" + "grunt-autoprefixer": "~0.8.2", + "grunt-browserify": "~2.1.4" } } diff --git a/scss/_vars.scss b/scss/_vars.scss index d1b8ad3..5cd2ec7 100755 --- a/scss/_vars.scss +++ b/scss/_vars.scss @@ -19,7 +19,7 @@ $breakpoint-md: 768px; $breakpoint-ld: 1200px; $breakpoints-list: ( - 'sd' '(max-width:' + $breakpoint-sm + ')', + 'sd' '(max-width:' + $breakpoint-sd + ')', 'md' '(min-width:' + ($breakpoint-md + 1) + ') and (max-width:' + ($breakpoint-ld - 1) + ')', 'ld' '(min-width:' + $breakpoint-ld + ')' ); diff --git a/style.css b/style.css index 127db2c..f600ab6 100644 --- a/style.css +++ b/style.css @@ -1,603 +1 @@ -/* -Theme Name: Bare Bones -Theme URI: http://github.com/mikefrancis/barebones -Author: Mike Francis -*/ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { - border: 0; - font-size: 100%; - font: inherit; - margin: 0; - padding: 0; - vertical-align: baseline; -} - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -menu, -nav, -section, -main { - display: block; -} - -address, -caption, -cite, -dfn, -th, -var { - font-style: normal; - font-weight: normal; -} - -blockquote, q { - quotes: none; -} - -blockquote:before, blockquote:after, -q:before, -q:after { - content: ''; - content: none; -} - -table { - border-collapse: collapse; - border-spacing: 0; -} - -th { - font-weight: bold; - text-align: left; -} - -.alignleft { - float: left; -} - -img.alignleft { - margin-right: 24px; -} - -.alignright { - float: right; -} - -img.alignright { - margin-left: 24px; -} - -.aligncenter { - display: block; - margin-left: auto; - margin-right: auto; -} - -img.aligncenter { - margin-bottom: 24px; -} - -.clearfix:before, .form__group .form__group__controls:before, .row:before, .clearfix:after, .form__group .form__group__controls:after, .row:after { - content: ''; - display: table; - line-height: 0; -} -.clearfix:after, .form__group .form__group__controls:after, .row:after { - clear: both; -} - -*, -*:before, -*:after { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - font-smoothing: antialiased; - text-rendering: optimizeLegibility; -} - -html { - background-color: white; - color: #444444; - font: 100%/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; - min-height: 100%; -} - -a { - color: #444444; - text-decoration: none; -} - -h1, -h2, -h3, -h4, -h5, -h6, -p, -hr, -ul, -ol { - margin-bottom: 24px; -} - -h1, -h2, -h3, -h4, -h5, -h6 { - line-height: 24px; -} - -h1 { - font-size: 32px; - font-size: 2rem; -} - -h2 { - font-size: 28px; - font-size: 1.75rem; -} - -h3 { - font-size: 24px; - font-size: 1.5rem; -} - -h4 { - font-size: 20px; - font-size: 1.25rem; -} - -h5, -h6 { - font-size: 16px; - font-size: 1rem; -} - -ul, -ol { - margin-left: 24px; -} - -ul ul, -ol ol { - margin-bottom: 0; -} - -img { - display: block; - height: auto; - max-width: 100%; -} - -blockquote { - font-family: serif; - padding-left: 24px; -} - -em { - font-style: italic; -} - -hr { - background-color: #444444; - border: 0; - color: #444444; - height: 1px; -} - -h1, -h2, -h3, -h4, -h5, -h6, -strong, -th { - font-weight: bold; -} - -table { - width: 100%; -} -table th, -table td { - padding: 6px; - text-align: left; -} - -input, -select, -textarea { - background-color: white; - border: solid 1px #444444; - color: #444444; - display: inline-block; - font: inherit; - line-height: 24px; - padding: 6px; - width: 100%; -} - -input[type="checkbox"], -input[type="radio"] { - background: transparent; - border: 0; - width: auto; -} - -label { - display: block; - font-weight: bold; -} - -select { - height: 36px; -} - -textarea { - min-height: 96px; -} - -.form__group { - margin-bottom: 24px; -} -.form__group .form__group__controls label { - font-weight: normal; -} -.form__group .form__group__controls.form__group__controls--inline label { - display: inline-block; -} - -.container { - max-width: 1200px; - margin: 0 auto; - clear: both; -} - -.row { - clear: both; - margin-left: -20px; -} - -.col { - float: left; - padding-left: 20px; - margin-bottom: 20px; -} -.col .row { - margin-top: 20px; -} - -@media only screen and (max-width: 640px) { - .col .col { - margin-bottom: 20px; - } - .col .col:last-child { - margin-bottom: 0; - } - - .col--sd-1 { - width: 8.33333%; - } - - .col--sd-offset-1 { - margin-left: 8.33333%; - } - - .col--sd-2 { - width: 16.66667%; - } - - .col--sd-offset-2 { - margin-left: 16.66667%; - } - - .col--sd-3 { - width: 25%; - } - - .col--sd-offset-3 { - margin-left: 25%; - } - - .col--sd-4 { - width: 33.33333%; - } - - .col--sd-offset-4 { - margin-left: 33.33333%; - } - - .col--sd-5 { - width: 41.66667%; - } - - .col--sd-offset-5 { - margin-left: 41.66667%; - } - - .col--sd-6 { - width: 50%; - } - - .col--sd-offset-6 { - margin-left: 50%; - } - - .col--sd-7 { - width: 58.33333%; - } - - .col--sd-offset-7 { - margin-left: 58.33333%; - } - - .col--sd-8 { - width: 66.66667%; - } - - .col--sd-offset-8 { - margin-left: 66.66667%; - } - - .col--sd-9 { - width: 75%; - } - - .col--sd-offset-9 { - margin-left: 75%; - } - - .col--sd-10 { - width: 83.33333%; - } - - .col--sd-offset-10 { - margin-left: 83.33333%; - } - - .col--sd-11 { - width: 91.66667%; - } - - .col--sd-offset-11 { - margin-left: 91.66667%; - } - - .col--sd-12 { - width: 100%; - } - - .col--sd-offset-12 { - margin-left: 100%; - } -} -@media only screen and (min-width: 641px) and (max-width: 1199px) { - .col--md-1 { - width: 8.33333%; - } - - .col--md-offset-1 { - margin-left: 8.33333%; - } - - .col--md-2 { - width: 16.66667%; - } - - .col--md-offset-2 { - margin-left: 16.66667%; - } - - .col--md-3 { - width: 25%; - } - - .col--md-offset-3 { - margin-left: 25%; - } - - .col--md-4 { - width: 33.33333%; - } - - .col--md-offset-4 { - margin-left: 33.33333%; - } - - .col--md-5 { - width: 41.66667%; - } - - .col--md-offset-5 { - margin-left: 41.66667%; - } - - .col--md-6 { - width: 50%; - } - - .col--md-offset-6 { - margin-left: 50%; - } - - .col--md-7 { - width: 58.33333%; - } - - .col--md-offset-7 { - margin-left: 58.33333%; - } - - .col--md-8 { - width: 66.66667%; - } - - .col--md-offset-8 { - margin-left: 66.66667%; - } - - .col--md-9 { - width: 75%; - } - - .col--md-offset-9 { - margin-left: 75%; - } - - .col--md-10 { - width: 83.33333%; - } - - .col--md-offset-10 { - margin-left: 83.33333%; - } - - .col--md-11 { - width: 91.66667%; - } - - .col--md-offset-11 { - margin-left: 91.66667%; - } - - .col--md-12 { - width: 100%; - } - - .col--md-offset-12 { - margin-left: 100%; - } -} -@media only screen and (min-width: 1200px) { - .col--ld-1 { - width: 8.33333%; - } - - .col--ld-offset-1 { - margin-left: 8.33333%; - } - - .col--ld-2 { - width: 16.66667%; - } - - .col--ld-offset-2 { - margin-left: 16.66667%; - } - - .col--ld-3 { - width: 25%; - } - - .col--ld-offset-3 { - margin-left: 25%; - } - - .col--ld-4 { - width: 33.33333%; - } - - .col--ld-offset-4 { - margin-left: 33.33333%; - } - - .col--ld-5 { - width: 41.66667%; - } - - .col--ld-offset-5 { - margin-left: 41.66667%; - } - - .col--ld-6 { - width: 50%; - } - - .col--ld-offset-6 { - margin-left: 50%; - } - - .col--ld-7 { - width: 58.33333%; - } - - .col--ld-offset-7 { - margin-left: 58.33333%; - } - - .col--ld-8 { - width: 66.66667%; - } - - .col--ld-offset-8 { - margin-left: 66.66667%; - } - - .col--ld-9 { - width: 75%; - } - - .col--ld-offset-9 { - margin-left: 75%; - } - - .col--ld-10 { - width: 83.33333%; - } - - .col--ld-offset-10 { - margin-left: 83.33333%; - } - - .col--ld-11 { - width: 91.66667%; - } - - .col--ld-offset-11 { - margin-left: 91.66667%; - } - - .col--ld-12 { - width: 100%; - } - - .col--ld-offset-12 { - margin-left: 100%; - } -} -.nav { - list-style: none; - margin: 0; -} -.nav > li { - display: inline-block; -} -.nav > li > a { - display: block; -} - -.btn { - background-color: #444444; - border: 0; - color: white; - cursor: pointer; - display: inline-block; - font: inherit; - font-weight: bold; - height: 36px; - line-height: 36px; - padding: 0 24px; - text-align: center; - width: auto; -} +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;margin:0;padding:0;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,main{display:block}address,caption,cite,dfn,th,var{font-style:normal;font-weight:normal}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}th{font-weight:bold;text-align:left}.alignleft{float:left}img.alignleft{margin-right:24px}.alignright{float:right}img.alignright{margin-left:24px}.aligncenter{display:block;margin-left:auto;margin-right:auto}img.aligncenter{margin-bottom:24px}.clearfix:before,.form__group .form__group__controls:before,.container:before,.row:before,.clearfix:after,.form__group .form__group__controls:after,.container:after,.row:after{content:'';display:table;line-height:0}.clearfix:after,.form__group .form__group__controls:after,.container:after,.row:after{clear:both}*,*:before,*:after{box-sizing:border-box;font-smoothing:antialiased;text-rendering:optimizeLegibility}html{background-color:#fff;color:#444;font:100%/1.5 "Helvetica Neue",Helvetica,Arial,sans-serif;min-height:100%}a{color:#444;text-decoration:none}h1,h2,h3,h4,h5,h6,p,hr,ul,ol{margin-bottom:24px}h1,h2,h3,h4,h5,h6{line-height:24px}h1{font-size:32px;font-size:2rem}h2{font-size:28px;font-size:1.75rem}h3{font-size:24px;font-size:1.5rem}h4{font-size:20px;font-size:1.25rem}h5,h6{font-size:16px;font-size:1rem}ul,ol{margin-left:24px}ul ul,ol ol{margin-bottom:0}img{display:block;height:auto;max-width:100%}blockquote{font-family:serif;padding-left:24px}em{font-style:italic}hr{background-color:#444;border:0;color:#444;height:1px}h1,h2,h3,h4,h5,h6,strong,th{font-weight:bold}table{width:100%}table th,table td{padding:6px;text-align:left}input,select,textarea{background-color:#fff;border:solid 1px #444;color:#444;display:inline-block;font:inherit;line-height:24px;padding:6px;width:100%}input[type="checkbox"],input[type="radio"]{background:transparent;border:0;width:auto}label{display:block;font-weight:bold}select{height:36px}textarea{min-height:96px}.form__group{margin-bottom:24px}.form__group .form__group__controls label{font-weight:normal}.form__group .form__group__controls.form__group__controls--inline label{display:inline-block}.container{max-width:1200px;margin:0 auto}.row{margin-left:-20px}.col{float:left;padding-left:20px}@media only screen and (max-width: 640px){.col .col{margin-bottom:20px}.col .col:last-child{margin-bottom:0}.col--sd-1{width:8.33333%}.col--sd-offset-1{margin-left:8.33333%}.col--sd-2{width:16.66667%}.col--sd-offset-2{margin-left:16.66667%}.col--sd-3{width:25%}.col--sd-offset-3{margin-left:25%}.col--sd-4{width:33.33333%}.col--sd-offset-4{margin-left:33.33333%}.col--sd-5{width:41.66667%}.col--sd-offset-5{margin-left:41.66667%}.col--sd-6{width:50%}.col--sd-offset-6{margin-left:50%}.col--sd-7{width:58.33333%}.col--sd-offset-7{margin-left:58.33333%}.col--sd-8{width:66.66667%}.col--sd-offset-8{margin-left:66.66667%}.col--sd-9{width:75%}.col--sd-offset-9{margin-left:75%}.col--sd-10{width:83.33333%}.col--sd-offset-10{margin-left:83.33333%}.col--sd-11{width:91.66667%}.col--sd-offset-11{margin-left:91.66667%}.col--sd-12{width:100%}.col--sd-offset-12{margin-left:100%}}@media only screen and (min-width: 769px) and (max-width: 1199px){.col--md-1{width:8.33333%}.col--md-offset-1{margin-left:8.33333%}.col--md-2{width:16.66667%}.col--md-offset-2{margin-left:16.66667%}.col--md-3{width:25%}.col--md-offset-3{margin-left:25%}.col--md-4{width:33.33333%}.col--md-offset-4{margin-left:33.33333%}.col--md-5{width:41.66667%}.col--md-offset-5{margin-left:41.66667%}.col--md-6{width:50%}.col--md-offset-6{margin-left:50%}.col--md-7{width:58.33333%}.col--md-offset-7{margin-left:58.33333%}.col--md-8{width:66.66667%}.col--md-offset-8{margin-left:66.66667%}.col--md-9{width:75%}.col--md-offset-9{margin-left:75%}.col--md-10{width:83.33333%}.col--md-offset-10{margin-left:83.33333%}.col--md-11{width:91.66667%}.col--md-offset-11{margin-left:91.66667%}.col--md-12{width:100%}.col--md-offset-12{margin-left:100%}}@media only screen and (min-width: 1200px){.col--ld-1{width:8.33333%}.col--ld-offset-1{margin-left:8.33333%}.col--ld-2{width:16.66667%}.col--ld-offset-2{margin-left:16.66667%}.col--ld-3{width:25%}.col--ld-offset-3{margin-left:25%}.col--ld-4{width:33.33333%}.col--ld-offset-4{margin-left:33.33333%}.col--ld-5{width:41.66667%}.col--ld-offset-5{margin-left:41.66667%}.col--ld-6{width:50%}.col--ld-offset-6{margin-left:50%}.col--ld-7{width:58.33333%}.col--ld-offset-7{margin-left:58.33333%}.col--ld-8{width:66.66667%}.col--ld-offset-8{margin-left:66.66667%}.col--ld-9{width:75%}.col--ld-offset-9{margin-left:75%}.col--ld-10{width:83.33333%}.col--ld-offset-10{margin-left:83.33333%}.col--ld-11{width:91.66667%}.col--ld-offset-11{margin-left:91.66667%}.col--ld-12{width:100%}.col--ld-offset-12{margin-left:100%}}.nav{list-style:none;margin:0}.nav>li{display:inline-block}.nav>li>a{display:block}.btn{background-color:#444;border:0;color:#fff;cursor:pointer;display:inline-block;font:inherit;font-weight:bold;height:36px;line-height:36px;padding:0 24px;text-align:center;width:auto}