Created
March 22, 2022 14:38
-
-
Save kankadev/d9ba7bfc347edca3a180e40ead60713a to your computer and use it in GitHub Desktop.
mysqlbackup, SCSS compile, minify etc.
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
module.exports = function (grunt) { | |
grunt.initConfig({ | |
theme_path: 'WordPress/wp-content/themes/bad-teammates', | |
pkg: grunt.file.readJSON('package.json'), | |
sass: { | |
dev: { | |
options: { | |
}, | |
files: { | |
'<%= theme_path %>/style.css': '<%= theme_path %>/styles/scss/style.scss' | |
} | |
}, | |
dist: { | |
options: { | |
style: 'compressed', | |
sourcemap: false | |
}, | |
files: { | |
'<%= theme_path %>/style.css': '<%= theme_path %>/styles/scss/style.scss' | |
} | |
} | |
}, | |
autoprefixer: { | |
dev: { | |
options: { | |
map: true | |
}, | |
files: { | |
'<%= theme_path %>/style.css': '<%= theme_path %>/style.css' | |
} | |
}, | |
dist: { | |
options: { | |
map: false | |
}, | |
files: { | |
'<%= theme_path %>/style.css': '<%= theme_path %>/style.css' | |
} | |
} | |
}, | |
watch: { | |
css: { | |
files: ['<%= theme_path %>/styles/**/*.scss'], | |
tasks: [ | |
'sass:dev', | |
'autoprefixer:dev', | |
'jshint' | |
] | |
} | |
}, | |
jshint: { | |
all: ['Gruntfile.js', '<%= theme_path %>/js/**/*.js'], | |
options: { | |
browser: true, | |
devel: true, | |
curly: true, | |
eqeqeq: true, | |
globals: { | |
jQuery: true, | |
}, | |
} | |
}, | |
run: { | |
options: { | |
// Task-specific options go here. | |
}, | |
mysqldump: { | |
cmd: 'node', | |
args: [ | |
'mysqldump.mjs' | |
] | |
} | |
}, | |
copy: { | |
main: { | |
files: [ | |
// includes files within path and its sub-directories | |
{ | |
expand: true, | |
cwd: 'node_modules/@fortawesome/', | |
src: ['**'], | |
dest: '<%= theme_path %>/styles/' | |
}, | |
], | |
}, | |
}, | |
}); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-autoprefixer'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-run'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
// default task: watch SASS & autoprefix it & JSHint | |
grunt.registerTask('default', ['watch']); | |
// backup database | |
grunt.registerTask('backup', ['run:mysqldump']); | |
// build SASS & autoprefix it & JSHint & backup database | |
grunt.registerTask('build', [ | |
'copy', | |
'sass:dist', | |
'autoprefixer:dist', | |
'jshint', | |
'run:mysqldump' | |
]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment