Created
January 24, 2013 07:16
-
-
Save chrisjung-dev/4618270 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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