Skip to content

Instantly share code, notes, and snippets.

@jprieton
Last active August 2, 2018 17:39
Show Gist options
  • Save jprieton/f2c373254b605e363337d1a2a9b75031 to your computer and use it in GitHub Desktop.
Save jprieton/f2c373254b605e363337d1a2a9b75031 to your computer and use it in GitHub Desktop.
Default Gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
lib: {
files: [
{
expand: true,
cwd: 'node_modules/bootstrap/dist/',
src: ['css/*.css', 'js/*.js'],
dest: 'assets/lib/bootstrap/'
},
{
expand: true,
cwd: 'node_modules/font-awesome/',
src: ['css/*.css', 'fonts/**'],
dest: 'assets/lib/font-awesome/'
},
{
expand: true,
cwd: 'node_modules/popper.js/dist/',
src: ['**'],
dest: 'assets/lib/popper.js/'
},
{
expand: true,
cwd: 'node_modules/animate.css/',
src: ['animate.css', 'animate.min.css'],
dest: 'assets/lib/animate.css/'
}
]
}
},
cssmin: {
options: {
mergeIntoShorthands: false,
roundingPrecision: -1
},
target: {
files: {
'style.min.css': ['style.css']
}
}
},
uglify: {
options: {
mangle: {
reserved: ['jQuery', '$']
}
},
target: {
files: {
'assets/js/public.min.js': ['assets/js/public.js'],
'assets/js/admin.min.js': ['assets/js/admin.js']
}
}
},
svgmin: {
min: {
files: [{
expand: true,
cwd: 'src/assets/images',
src: ['**/*.svg'],
dest: 'assets/images',
ext: '.svg'
}]
}
},
watch: {
scripts: {
files: ['assets/js/admin.js', 'assets/js/public.js'],
tasks: ['uglify'],
options: {
debounceDelay: 250
}
},
stylesheets: {
files: ['assets/css/public.css', 'assets/css/admin.css'],
tasks: ['cssmin'],
options: {
debounceDelay: 250
}
},
images: {
files: ['src/assets/images/**/*.svg'],
tasks: ['svgmin'],
options: {
debounceDelay: 250
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-svgmin');
// Default task(s).
grunt.registerTask('default', ['copy:lib', 'cssmin:target', 'uglify:target']);
};
@jprieton
Copy link
Author

jprieton commented Aug 2, 2018

npm install grunt grunt-svgmin grunt-contrib-copy grunt-contrib-watch grunt-contrib-cssmin grunt-contrib-uglify --save-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment