Skip to content

Instantly share code, notes, and snippets.

@fedek6

fedek6/Gruntfile.js

Created Jun 1, 2016
Embed
What would you like to do?
Gruntfile for Wordpress theme
/**
* Realhe.ro Gruntfile for Wordpress
*
* @version 1.0
*/
module.exports = function(grunt) {
grunt.initConfig( {
// Prepare banner
pkg : grunt.file.readJSON('package.json'),
banner : '/*! <%= pkg.name %> - v<%= pkg.version %> ' +
'<%= grunt.template.today("yyyy-mm-dd h:MM:ss") %>' +
'*/' + "\n",
// Concat all JS files
concat : {
dist : {
options : {
banner:'<%= banner %>'
},
files : {
'js/main.js' : 'source/js/*',
'js/plugins.js' : 'source/js/plugins/*'
}
}
},
// Compress JS
uglify : {
dist : {
options : {
banner:'<%= banner %>'
},
files : {
// main js
'js/main.min.js' : 'js/main.js',
// plugins
'js/plugins.min.js' : 'js/plugins.js',
}
}
},
// SASS
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'style.css': 'source/scss/style.scss'
}
}
},
// Add prefixes to css
postcss : {
options : {
processors: [
require('autoprefixer')({browsers: 'last 2 versions'}), // add vendor prefixes
]
},
dist : {
src : 'style.css'
}
},
} );
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask('default', ['concat', 'uglify', 'sass', 'postcss']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment