From 335401167af63e1493279f8a33ddd0dfb47978b8 Mon Sep 17 00:00:00 2001 From: Michael Rose Date: Wed, 11 Sep 2013 09:45:12 -0400 Subject: [PATCH 1/2] Setup Grunt build scripts --- .gitignore | 1 + .jshintrc | 20 + Gruntfile.js | 106 +++ _config.yml | 2 +- _includes/head.html | 2 +- _includes/scripts.html | 2 +- assets/css/main.css | 731 ------------------ assets/js/{main.js => _main.js} | 0 assets/js/main.min.js | 1 - .../js/{vendor => plugins}/jquery.fitvids.js | 0 .../jquery.magnific-popup.js | 0 assets/js/{vendor => plugins}/respond.js | 0 package.json | 25 + 13 files changed, 155 insertions(+), 735 deletions(-) create mode 100644 .jshintrc create mode 100644 Gruntfile.js delete mode 100644 assets/css/main.css rename assets/js/{main.js => _main.js} (100%) delete mode 100644 assets/js/main.min.js rename assets/js/{vendor => plugins}/jquery.fitvids.js (100%) rename assets/js/{vendor => plugins}/jquery.magnific-popup.js (100%) rename assets/js/{vendor => plugins}/respond.js (100%) create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 6a4e31c..1701816 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ _site *.sublime-project *.sublime-workspace codekit-config.json +node_modules Gemfile.lock \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..c7fe066 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,20 @@ +{ + "bitwise": true, + "browser": true, + "curly": true, + "eqeqeq": true, + "eqnull": true, + "es5": false, + "esnext": true, + "immed": true, + "jquery": true, + "latedef": true, + "newcap": true, + "noarg": true, + "node": true, + "strict": false, + "trailing": false, + "undef": true, + "multistr": true, + "expr": true +} \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..7c49637 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,106 @@ +'use strict'; +module.exports = function(grunt) { + + grunt.initConfig({ + jshint: { + options: { + jshintrc: '.jshintrc' + }, + all: [ + 'Gruntfile.js', + 'assets/js/*.js', + '!assets/js/plugins/*.js', + '!assets/js/scripts.min.js' + ] + }, + recess: { + dist: { + options: { + compile: true, + compress: true + }, + files: { + 'assets/css/main.min.css': [ + 'assets/less/main.less' + ] + } + } + }, + uglify: { + dist: { + files: { + 'assets/js/scripts.min.js': [ + 'assets/js/plugins/*.js', + 'assets/js/_*.js' + ] + } + } + }, + imagemin: { + dist: { + options: { + optimizationLevel: 7, + progressive: true + }, + files: [{ + expand: true, + cwd: 'images/', + src: '{,*/}*.{png,jpg,jpeg}', + dest: 'images/' + }] + } + }, + svgmin: { + dist: { + files: [{ + expand: true, + cwd: 'images/', + src: '{,*/}*.svg', + dest: 'images/' + }] + } + }, + watch: { + less: { + files: [ + 'assets/less/*.less' + ], + tasks: ['recess'] + }, + js: { + files: [ + '<%= jshint.all %>' + ], + tasks: ['jshint','uglify'] + } + }, + clean: { + dist: [ + 'assets/css/main.min.css', + 'assets/js/scripts.min.js' + ] + } + }); + + // Load tasks + grunt.loadNpmTasks('grunt-contrib-clean'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-recess'); + grunt.loadNpmTasks('grunt-contrib-imagemin'); + grunt.loadNpmTasks('grunt-svgmin'); + + // Register tasks + grunt.registerTask('default', [ + 'clean', + 'recess', + 'uglify', + 'imagemin', + 'svgmin' + ]); + grunt.registerTask('dev', [ + 'watch' + ]); + +}; \ No newline at end of file diff --git a/_config.yml b/_config.yml index ae76a85..b21d211 100644 --- a/_config.yml +++ b/_config.yml @@ -65,4 +65,4 @@ kramdown: coderay_css: class include: [".htaccess"] -exclude: ["lib", "config.rb", "Capfile", "config", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec"] \ No newline at end of file +exclude: ["lib", "config.rb", "Capfile", "config", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"] \ No newline at end of file diff --git a/_includes/head.html b/_includes/head.html index b65360c..99d19fc 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -34,7 +34,7 @@ - + diff --git a/_includes/scripts.html b/_includes/scripts.html index 6b4a6a8..9c2c7d3 100644 --- a/_includes/scripts.html +++ b/_includes/scripts.html @@ -1,6 +1,6 @@ - + {% if site.google_analytics %}