Skip to content

Instantly share code, notes, and snippets.

@leemcalilly
Created May 16, 2014 21:18
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 leemcalilly/ada1bfc873eed6db6efd to your computer and use it in GitHub Desktop.
Save leemcalilly/ada1bfc873eed6db6efd to your computer and use it in GitHub Desktop.
'use strict';
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
// configurable paths
var yeomanConfig = {
app: '.',
dist: 'dist'
};
grunt.initConfig({
yeoman: yeomanConfig,
watch: {
compass: {
files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
tasks: ['compass:live']
},
assets: {
files: ['<%= yeoman.app %>/assets/*.*'],
tasks: ['imagemin']
},
css: {
files: ['.tmp/styles/*.css'],
tasks: ['cssmin']
},
js: {
files: ['<%= yeoman.app %>/scripts/*.js'],
tasks: ['concat:live']
},
haml: {
files: ['<%= yeoman.app %>/{layout,snippets,templates}/**/*.haml'],
tasks: ['haml']
},
update: {
files: ['<%= yeoman.app %>/{layout,snippets,templates}/**/*.liquid'],
tasks: ['copy']
},
config: {
files: ['<%= yeoman.app %>/config/*.{html,json}'],
tasks: ['copy']
}
},
clean: {
dist: [
'.tmp',
'<%= yeoman.dist %>/*'
]
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
]
},
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
imagesDir: '<%= yeoman.app %>/assets',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/assets',
importPath: 'components',
relativeAssets: true
},
dist: {},
live: {
options: {
debugInfo: true
}
}
},
uglify: {
dist: {
files: {
'<%= yeoman.dist %>/assets/custom.modernizr.js': [
'<%= yeoman.app %>/components/foundation/js/vendor/custom.modernizr.js'
],
'<%= yeoman.dist %>/assets/main.js': [
'<%= yeoman.app %>/components/foundation/js/vendor/jquery.js',
'<%= yeoman.app %>/components/foundation/js/foundation/foundation.js',
'<%= yeoman.app %>/components/foundation/js/foundation/foundation.*.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
],
}
},
},
concat: {
live: {
files: {
'<%= yeoman.dist %>/assets/custom.modernizr.js': [
'<%= yeoman.app %>/components/foundation/js/vendor/custom.modernizr.js'
],
'<%= yeoman.dist %>/assets/main.js': [
'<%= yeoman.app %>/components/foundation/js/vendor/jquery.js',
'<%= yeoman.app %>/components/foundation/js/foundation/foundation.js',
'<%= yeoman.app %>/components/foundation/js/foundation/foundation.*.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
],
}
}
},
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/assets',
src: '{,*/}*.{png,jpg,jpeg}',
dest: '<%= yeoman.dist %>/assets'
}]
}
},
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/assets/main.css': [
'.tmp/styles/{,*/}*.css',
'<%= yeoman.app %>/styles/{,*/}*.css'
]
}
}
},
haml: {
dist: {
options: { language: 'ruby' },
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'layout/*.haml',
'snippets/*.haml',
'templates/*.haml',
'templates/*/**.haml'
],
ext: '.liquid'
}]
// files: grunt.file.expandMapping(['<%= yeoman.app %>/layout/*.haml'], 'dist/', {
// rename: function(base, path) {
// return base + path.replace(/\.haml$/, '.liquid');
// }
// })
}
},
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'assets/*',
'config/*',
'layout/*.liquid',
'snippets/*.liquid',
'templates/*.liquid'
]
},{
expand: true,
cwd: '<%= yeoman.app %>/components/font-awesome/font',
dest: '<%= yeoman.dist %>/assets',
src: [
'*'
]
}]
},
}
});
grunt.renameTask('regarde', 'watch');
grunt.registerTask('live', [
'clean:dist',
'compass:live',
'cssmin',
'concat:live',
'haml',
'copy',
'watch'
]);
grunt.registerTask('build', [
'clean:dist',
'compass:dist',
'cssmin',
'imagemin',
'uglify',
'haml',
'copy'
]);
grunt.registerTask('default', [
'jshint',
'build'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment