Last active
December 4, 2015 09:32
-
-
Save davemac/f901ec5b5e679074f1ae to your computer and use it in GitHub Desktop.
Gruntfile, as it stands now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = function(grunt) { | |
// load all grunt tasks | |
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
var jsFoundation = [ | |
'bower_components/foundation/js/foundation/foundation.js', | |
// 'bower_components/foundation/js/foundation/foundation.abide.js', | |
// 'bower_components/foundation/js/foundation/foundation.accordion.js', | |
// 'bower_components/foundation/js/foundation/foundation.alert.js', | |
// 'bower_components/foundation/js/foundation/foundation.clearing.js', | |
// 'bower_components/foundation/js/foundation/foundation.dropdown.js', | |
// 'bower_components/foundation/js/foundation/foundation.equalizer.js', | |
// 'bower_components/foundation/js/foundation/foundation.interchange.js', | |
// 'bower_components/foundation/js/foundation/foundation.joyride.js', | |
// 'bower_components/foundation/js/foundation/foundation.magellan.js', | |
'bower_components/foundation/js/foundation/foundation.offcanvas.js', | |
// 'bower_components/foundation/js/foundation/foundation.orbit.js', | |
// 'bower_components/foundation/js/foundation/foundation.reveal.js', | |
// 'bower_components/foundation/js/foundation/foundation.slider.js', | |
// 'bower_components/foundation/js/foundation/foundation.tab.js', | |
// 'bower_components/foundation/js/foundation/foundation.tooltip.js', | |
'bower_components/foundation/js/foundation/foundation.topbar.js' | |
]; | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { | |
options: { | |
includePaths: ['bower_components/foundation/scss'] | |
}, | |
dist: { | |
options: { | |
outputStyle: 'nested', | |
sourceMap: true | |
}, | |
files: { | |
// 'css/app.css': 'scss/app.scss', | |
'css/style.css': 'scss/style.scss' | |
} | |
} | |
}, | |
// uglify: { | |
// options: { | |
// mangle: false | |
// }, | |
// my_target: { | |
// files: { | |
// 'js/modernizr.min.js': ['bower_components/modernizr/modernizr.js'] | |
// } | |
// }, | |
// build: { | |
// options: { | |
// banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
// }, | |
// files: { | |
// 'build/js/vendor.min.js': [ | |
// 'js/modernizr.foundation.js' | |
// ], | |
// 'build/js/foundation.min.js': [ | |
// 'js/jquery.foundation.orbit.js', | |
// 'js/jquery.foundation.topbar.js', | |
// 'js/jquery.offcanvas.js', | |
// 'js/app.js' | |
// ] | |
// } | |
// } | |
// }, | |
// auto vendor prefixes | |
autoprefixer: { | |
options: { | |
cascade: true | |
}, | |
single_file: { | |
src: 'style.css', | |
dest: 'build/css/style.css' | |
}, | |
}, | |
favicons: { | |
options: { | |
html: 'build/favicons.html', | |
HTMLPrefix: "<?php echo get_template_directory_uri(); ?>;/img/icons/", | |
windowsTile: false, | |
}, | |
icons: { | |
src: 'img/favicon-src.png', | |
dest: 'img/icons' | |
} | |
}, | |
// copy: { | |
// main: { | |
// nonull: true, | |
// src: 'bower_components/foundation/js/foundation.min.js', | |
// dest: 'js/foundation.min.js' | |
// } | |
// }, | |
bower_concat: { | |
foundation: { | |
dest: 'js/foundation.js', | |
include: [ | |
'foundation', | |
] | |
}, | |
others: { | |
dest: 'js/vendor.js', | |
cssDest: 'css/vendor.css', | |
include: [ | |
'slick-carousel', | |
'fontawesome', | |
'headroom.js', | |
'isotope', | |
// 'imagesloaded' | |
], | |
mainFiles: { | |
'isotope': ['dist/isotope.pkgd.min.js'], | |
} | |
}, | |
}, | |
uglify: { | |
bower: { | |
options: { | |
mangle: true, | |
beautify: false, | |
compress: true | |
}, | |
files: { | |
'js/bower.min.js': [jsFoundation, 'js/app.js', 'js/vendor.js'] | |
} | |
}, | |
}, | |
// deploy files using rsync | |
deploy: { | |
options: { | |
args: ["--verbose"], | |
exclude: ['.git*', 'node_modules', 'backups', 'build/uploads', 'Gruntfile.js', 'package.json', '.DS_Store', 'README.md', 'config.rb', '.jshintrc', '.sass-cache', 'scss', 'bower_components', '.bowerrc', 'bower.json'], | |
recursive: true, | |
ssh: true | |
}, | |
staging: { | |
options: { | |
src: "./", | |
dest: "~/www/wp-content/themes/batlogic", | |
host: "batlogic-s", | |
} | |
} | |
}, | |
watch: { | |
grunt: { | |
files: ['Gruntfile.js'], | |
options: { livereload: true }, | |
}, | |
sass: { | |
files: 'scss/**/*.scss', | |
tasks: ['sass'], | |
}, | |
changes: { | |
// files: ['*.html', '*.php', '*.css', 'images/**/*.{png,jpg,jpeg,gif,webp,svg}', '!node_modules/**/*'], | |
files: ['css/style.css', '*.php', 'images/**/*.{png,jpg,jpeg,gif,webp,svg}', '!node_modules/**/*.*', '!.**/**/*.*'], | |
options: { | |
livereload: true, | |
}, | |
} | |
} | |
}); | |
// rename tasks | |
grunt.renameTask('rsync', 'deploy'); | |
grunt.registerTask('style', ['sass']); | |
grunt.registerTask('build', ['style','autoprefixer', 'uglify']); | |
grunt.registerTask('buildbower', ['bower_concat', 'uglify:bower']); | |
grunt.registerTask('default', ['style','watch']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment