Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Luciaisacomputer/c3dd88c8ad9f097d9583 to your computer and use it in GitHub Desktop.
Save Luciaisacomputer/c3dd88c8ad9f097d9583 to your computer and use it in GitHub Desktop.
A grunt setup for using Browser Sync and Slick JS with FoundationPress. Will Add to this as I need more things.
module.exports = function(grunt) {
// time
require('time-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
// If you can't get source maps to work, run the following command in your terminal:
// $ sass scss/foundation.scss:css/foundation.css --sourcemap
// (see this link for details: http://thesassway.com/intermediate/using-source-maps-with-sass )
sourceMap: true
},
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'css/foundation.css': 'scss/foundation.scss'
}
},
},
copy: {
scripts: {
expand: true,
cwd: 'bower_components/foundation/js/vendor/',
src: '**',
flatten: 'true',
dest: 'js/vendor/'
},
iconfonts: {
expand: true,
cwd: 'bower_components/fontawesome/',
src: ['**', '!**/less/**', '!**/css/**', '!bower.json'],
dest: 'assets/fontawesome/'
},
slider:{
expand: true,
cwd: 'bower_components/slick.js/slick/',
src: 'slick.min.js',
dest: 'js/custom/'
},
sliderstyles:{
expand: true,
cwd: 'bower_components/slick.js/slick/',
src: ['**', '!slick.css', '!slick.js','!slick.min.js', '!bower.json', '!.bower.json','!component.json', 'congif.rb','!CONTRIBUTING.markdown', '!License','!Makefile', '!package.json', '!README.markdown', '!slick.jquery.json', '!slick-theme.css'],
dest: 'assets/slick.js'
},
},
'string-replace': {
fontawesome: {
files: {
'assets/fontawesome/scss/_variables.scss': 'assets/fontawesome/scss/_variables.scss'
},
options: {
replacements: [
{
pattern: '../fonts',
replacement: '../assets/fontawesome/fonts'
}
]
}
},
},
concat: {
options: {
separator: ';',
},
dist: {
src: [
// Foundation core
'bower_components/foundation/js/foundation/foundation.js',
// Pick the componenets you need in your project
'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',
// Include your own custom scripts (located in the custom folder)
'js/custom/*.js'
],
// Finally, concatinate all the files above into one single file
dest: 'js/foundation.js',
},
},
uglify: {
dist: {
files: {
// Shrink the file size by removing spaces
'js/foundation.js': ['js/foundation.js']
}
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: 'scss/**/*.scss',
tasks: ['sass'],
options: {
livereload:true,
}
},
all: {
files: '**/*.php',
options: {
livereload:true,
}
}
},
browserSync: {
dev: {
bsFiles: {
src : 'css/foundation.css'
},
options: {
proxy: "websitename.dev"
}
}
},
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-browser-sync');
grunt.registerTask('build', ['copy', 'string-replace:fontawesome', 'sass', 'concat', 'uglify']);
grunt.registerTask('default', ['browserSync','watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment