javascript - Grunt, how to minify different folders (to include node_modules folder) -
i using npm in wp project.
i have grunt task compiles separate scss files css files , minifies them 1 default.min.css
file when running grunt
(that's good.)
my main issue include different npm packages such fontawesome, bootstrap etc. minified 1 minified min.css file, own files.
i know how own *.js
files uglify'd different packages i'm using (jquery-ui, owl-carousel, etc.)
please find below gruntfile.js, first gruntfile.js feel free include constructive remarks.
thanks, bud
gruntfile.js
module.exports = function (grunt) { grunt.initconfig({ sass: { dist: { files: [{ expand: true, cwd: 'resource/scss/', src: ['*.scss'], dest: 'resource/builds/css/', ext: '.css' }] } }, watch: { css: { files: '**/*.scss', tasks: ['sass', 'cssmin'] }, scripts: { files: 'resource/js/*.js', tasks: ['uglify'] } }, cssmin: { target: { files: [{ expand: true, cwd: 'resource/builds/css/', src: ['*.css', '!*.min.css'], dest: 'public/css', ext: '.min.css' }] } }, concat: { js: { options: { separator: ';' }, src: 'resource/**/*.js', dest: '<%= paths.dest.js %>' } }, uglify: { build: { files: [{ expand: true, cwd: 'resource/js/', src: '**/*.js', dest: 'public/js', ext: '.min.js' }] } } }); grunt.loadnpmtasks('grunt-contrib-sass'); grunt.loadnpmtasks('grunt-concat'); grunt.loadnpmtasks('grunt-contrib-cssmin'); grunt.loadnpmtasks('grunt-contrib-uglify'); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.registertask('default',['cssmin', 'uglify', 'watch']); };
Comments
Post a Comment