javascript - message: 'Unexpected token: punc (.)', while using uglify in grunt -
goal
my goal concatenate css,js files , minify of them. can minify concat.js
, i'm struggling trying minify concat.css
.
gruntfile.js
module.exports = function(grunt) { "use strict"; grunt.initconfig({ concat: { js: { src: [ 'js/bootstrap.min.js', 'js/jquery-1.10.2.min.js', 'js/jquery.easypiechart.min.js', 'js/jquery.isotope.min.js', 'js/jquery.magnific-popup.min.js', 'js/waypoints.min.js', 'js/respond.min.js', 'js/jquery.vegas.min.js', 'js/modernizr-2.6.2.min.js', 'js/jquery.nav.js', 'js/html5shiv.js', 'js/jquery.scrollto.js', 'js/jquery.sticky.js', 'js/jquery.validate.js', 'js/main.js', ], dest: 'dist/concat.js' }, css: { src: [ 'css/magnific-popup.css', 'css/main.css', 'css/xl.css', 'css/lg.css', 'css/md.css', 'css/sm.css', 'css/xs.css', 'css/print.css', 'css/bootstrap.min.css', 'css/font-awesome.min.css', ], dest: 'dist/concat.css' } }, watch: { js: { files: ['js/*.js'], task: ['concat:js'] }, css: { files: ['css/*.css'], task: ['concat:css'] } }, uglify: { js: { files: { 'dist/minified.js': ['dist/concat.js'] } }, css: { files: { 'dist/minified.css': ['dist/concat.css'] } } } }); grunt.loadnpmtasks('grunt-contrib-concat'); grunt.loadnpmtasks('grunt-contrib-uglify'); grunt.loadnpmtasks('grunt-contrib-watch'); grunt.registertask('default', ['concat', 'uglify']); };
result
i concatenate css , js files succesfully, , they're generated @ :
dist/concat.js
dist/concat.css
then, can minify concat.js
no problem, i'm struggling trying minify concat.css
.
i kept getting error in bottom of terminal :
running "uglify:css" (uglify) task { message: 'unexpected token: punc (.)', filename: 'concat.css', line: 4,
and line4 beginning of class : .mfp-bg {
can please give me little push here ? also, should perform minify after concatenation or other way around ? there better way ?
uglify
minimising javascript only, not css.
if want minimise css can use cssmin task grunt instead.
Comments
Post a Comment