Skip to content

Instantly share code, notes, and snippets.

@chrisjung-dev
Created January 24, 2013 07:16
Show Gist options
  • Save chrisjung-dev/4618270 to your computer and use it in GitHub Desktop.
Save chrisjung-dev/4618270 to your computer and use it in GitHub Desktop.
/*global module:false*/
module.exports = function(grunt) {
// Initialisiert Grunt mit den folgenden Projekteinstellungen
grunt.initConfig({
//pkg: grunt.file.readJSON('package.json'),
less: {
dev: {
options: {
paths: ["less"]
},
files: {
"style.css": "style.less"
}
},
prod: {
options: {
paths: ["less"],
compress: true
},
files: {
"style.css": "style.less"
}
}
},
/**
* Concat the header
*/
concat: {
prod: {
src: ['less/wp_header.less', 'style.css'],
dest: 'style.css'
}
},
/**
* compress to zip for deployment
*/
compress: {
zip: {
files: {
'dist/mein-template.zip': [
'*.php',
'*.css',
'license.txt',
'readme.txt',
'screenshot.png',
'font/**',
'img/**',
'inc/**',
'js/**',
'languages/**',
'layouts/**',
]
},
options: {
'flatten': false,
'rootDir': 'mein-template'
}
}
},
/*
replace: {
version: {
src: [ 'less/wp_header.less' ],
overwrite: true,
replacements: [{
from: /[0-9]{4}\.[0-9]{2}\.[0-9]{2}/g,
to: "<%= pkg.version %>"
}]
}
},
*/
/**
* Watch less files
*/
watch: {
styles: {
// not using "less.prod.files" but ALL less files.
files: '**/*.less',
tasks: ['less:dev']
}
}
});
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-compress');
//grunt.loadNpmTasks('grunt-text-replace');
// Default task, der ausgeführt wird, wenn man Grunt
// ohne weitere Parameter aufruft.
grunt.registerTask('default', ['less:dev']);
grunt.registerTask('production', ['less:prod', 'concat:prod', 'compress:zip']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment