Skip to content

Instantly share code, notes, and snippets.

@cdmo
Created February 4, 2015 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdmo/13114390489dc1b295e4 to your computer and use it in GitHub Desktop.
Save cdmo/13114390489dc1b295e4 to your computer and use it in GitHub Desktop.
for zurb_foundation theme in drupal
module.exports = function(grunt) {
"use strict";
var theme_name = 'f5';
var global_vars = {
theme_name: theme_name,
theme_css: 'css',
theme_scss: 'scss'
}
grunt.initConfig({
global_vars: global_vars,
pkg: grunt.file.readJSON('package.json'),
sass: {
options: {
outputStyle: 'compressed',
sourceMap: true,
includePaths: ['<%= global_vars.theme_scss %>', '<%= global_vars.theme_scss %>/vendor', require('node-bourbon').includePaths]
},
dist: {
files: {
'<%= global_vars.theme_css %>/<%= global_vars.theme_name %>.css': '<%= global_vars.theme_scss %>/<%= global_vars.theme_name %>.scss'
}
},
dist_custom: {
files: grunt.file.expandMapping(['scss/extra/*.scss'], 'css/', {
rename: function (dest, matched) {
return matched.replace(/scss/g, 'css');
}
})
}
},
copy: {
dist: {
files: [
{
expand:true,
cwd: 'bower_components/foundation/js',
src: ['foundation/*.js'], dest: 'js/', filter: 'isFile'
},
{
expand:true,
cwd: 'bower_components/foundation/',
src: ['foundation.min.js'],
dest: 'js/',
filter: 'isFile'
},
{
expand:true,
cwd: 'bower_components/foundation/js/vendor',
src: ['*.js'],
dest: 'js/vendor',
filter: 'isFile'
},
{
expand:true,
cwd: 'bower_components/foundation/scss/foundation',
src: ['**/*.scss'],
dest: 'scss/vendor/foundation',
filter: 'isFile'
},
{
expand:true,
cwd: 'bower_components/foundation/scss',
src: ['*.scss'],
dest: 'scss/vendor/foundation',
filter: 'isFile'
}
]
}
},
watch: {
grunt: { files: ['Gruntfile.js'] },
sass: {
files: '<%= global_vars.theme_scss %>/**/*.scss',
tasks: ['sass'],
options: {
livereload: true
}
}
},
sass_globbing: {
foundation: {
files: {
'scss/extra/_importMap.scss': 'scss/vendor/foundation/components/*.scss',
}
}
},
clean: {
js: [
"scss/vendor/foundation/**/*.scss",
"!scss/vendor/foundation/_variables.scss",
"js/vendor/*"
]
}
});
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass-globbing');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('erase', ['clean']);
grunt.registerTask('assemble', ['sass_globbing']);
grunt.registerTask('build', ['erase', 'copy', 'sass_globbing', 'sass']);
grunt.registerTask('default', ['build', 'watch']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment