zZzzZ.
home2
/
zrzvbdry
/
boutiquediscount.net
/
wp-content
/
themes
/
wp-coupon-pro
New Folder
Editing: Gruntfile.js
Save
Cancel
module.exports = function( grunt ) { 'use strict'; var pkgInfo = grunt.file.readJSON('package.json'); grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), // Autoprefixer. postcss: { options: { processors: [ require( 'autoprefixer' )({ browsers: [ '> 0.1%', 'ie 8', 'ie 9' ] }) ] }, dist: { src: ['assets/css/*.css', '*.css'] } }, // SASS sass: { options: { precision: 10 }, dist: { options: { style: 'expanded' }, files: [ {'style.css': 'assets/sass/style.scss'} ] } }, // Watch changes for assets. watch: { css: { files: [ 'assets/sass/*.scss' ], tasks: [ 'css' ] } }, copy: { main: { options: { mode: true }, src: [ '**', '!node_modules/**', '!build/**', '!css/sourcemap/**', '!.git/**', '!bin/**', '!.gitlab-ci.yml', '!bin/**', '!tests/**', '!phpunit.xml.dist', '!*.sh', '!*.map', '!Gruntfile.js', '!package.json', '!.gitignore', '!phpunit.xml', '!README.md', '!sass/**', '!codesniffer.ruleset.xml', '!vendor/**', '!composer.json', '!composer.lock', '!package-lock.json', '!phpcs.xml.dist' ], dest: 'wp-coupon-pro' } }, compress: { main: { options: { archive: 'wp-coupon-pro' + pkgInfo.version + '.zip', mode: 'zip' }, files: [ { src: [ './wp-coupon-pro/**' ] } ] } }, clean: { main: ["wp-coupon-pro"], zip: ["*.zip"] }, bumpup: { options: { updateProps: { pkg: 'package.json' } }, file: 'package.json' }, replace: { theme_main: { src: ['style.css', 'assets/sass/style.scss'], overwrite: true, replacements: [ { from: /Version: \bv?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-A-Z-]+(?:\.[\da-z-A-Z-]+)*)?(?:\+[\da-z-A-Z-]+(?:\.[\da-z-A-Z-]+)*)?\b/g, to: 'Version: <%= pkg.version %>' } ] } } }); // Load NPM tasks to be used here grunt.loadNpmTasks( 'grunt-contrib-watch' ); grunt.loadNpmTasks( 'grunt-postcss' ); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks( 'grunt-contrib-cssmin' ); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-wp-i18n'); grunt.loadNpmTasks('grunt-bumpup'); grunt.loadNpmTasks('grunt-text-replace'); // Register tasks grunt.registerTask('default', [ 'watch', 'sass' ]); grunt.registerTask( 'css', [ 'sass' ]); // To release new version just runt 2 commands below // Re create everything: grunt release --ver=<version_number> // Zip file installable: grunt zipfile grunt.registerTask('zipfile', ['clean:zip', 'copy:main', 'compress:main', 'clean:main']); grunt.registerTask('release', function (ver) { var newVersion = grunt.option('ver'); if (newVersion) { // Replace new version newVersion = newVersion ? newVersion : 'patch'; grunt.task.run('bumpup:' + newVersion); grunt.task.run('replace'); // i18n grunt.task.run([ 'css', 'postcss' ]); } }); };