Skip to content

Instantly share code, notes, and snippets.

@OdinsHat
Created January 18, 2015 17:14
Show Gist options
  • Save OdinsHat/a5eaa09ddab855723974 to your computer and use it in GitHub Desktop.
Save OdinsHat/a5eaa09ddab855723974 to your computer and use it in GitHub Desktop.
Example Magento Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
phplint: {
local: {
files: [{
expand: true,
cwd: 'app/code/local/',
src: ['**/*.php']
}]
},
community: {
files: [{
expand: true,
cwd: 'app/code/community/',
src: ['**/*.php']
}]
}
},
phpcs: {
local: {
dir: ['app/code/local/**/*.php']
},
community: {
dir: ['app/code/community/**/*.php']
},
options: {
bin: '/usr/local/bin/phpcs',
standard: 'Zend'
}
},
githooks: {
all: {
'pre-commit': 'phplint'
}
},
sass: {
dist: {
files: {
'skin/frontend/yourtheme/default/css/app.css' : 'skin/frontend/yourtheme/default/scss/app.scss'
}
}
},
watch: {
css: {
files: 'skin/frontend/yourtheme/default/scss/**/*.scss',
tasks: ['sass']
}
},
svgmin: {
dist: {
expand: true,
cwd: 'skin/frontend/yourtheme/default/images/raw',
src: ['*.svg'],
dest: 'skin/frontend/yourtheme/default/images'
}
},
jshint: {
},
uglify: {
options: {
compress: {
drop_console: true
}
},
frontend: {
files: {
'skin/frontend/yourtheme/default/yourapp.min.js': ['skin/frontend/yourtheme/default/js/yourapp.js']
}
}
},
clean: {
options: {
force: true
},
cache: {
src: ['var/cache/*']
},
sass: {
src: ['skin/frontend/yourtheme/default/.sass-cache/*']
}
}
});
grunt.loadNpmTasks('grunt-phplint');
grunt.loadNpmTasks('grunt-phpcs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-svgmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-githooks');
grunt.registerTask('default', ['sass', 'watch']);
};h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment