Created
June 1, 2016 21:16
-
-
Save fedek6/6b0c128a658ebb231bc693b215ec8451 to your computer and use it in GitHub Desktop.
Gruntfile for Wordpress theme
This file contains hidden or 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
/** | |
* 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