Skip to content

Instantly share code, notes, and snippets.

@ms-studio
Created June 2, 2016 15:55
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 ms-studio/e84809b85829e827d69268d3dea84d9f to your computer and use it in GitHub Desktop.
Save ms-studio/e84809b85829e827d69268d3dea84d9f to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: [
'css/build/*.css'
],
timestamp: grunt.template.today("yyyymmddHHMMss"), // Arbitrary property
// Combine & Minify CSS
cssmin: {
combine: {
options: {
banner: '/*! styles for <%= pkg.name %> - generated <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
files: {
'css/build/styles.<%= timestamp %>.css': ['css/dev/00-main.css']
}
}
},
// Update the register_styles function
replace: {
scripts: {
src: ['functions.php'],
overwrite: true,
replacements: [{
from: /css\/build\/styles\.(\d+)\.css/,
to: 'css/build/styles.<%= timestamp %>.css'
}, {
from: /Change-Detector-X/,
to: 'Change-Detector-XX'
}]
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// grunt.loadNpmTasks('grunt-contrib-concat');
// grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-text-replace');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', [
'clean',
'cssmin',
// 'concat',
// 'uglify',
'replace'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment