Menu
  • HOME
  • TAGS

message: 'Unexpected token: punc (.)', while using uglify in grunt

javascript,css,gruntjs,grunt-contrib-uglify

uglify is for minimising JavaScript only, not CSS. If you want to minimise CSS you can use the cssmin task for Grunt instead....

Grunt uglify - replace original file

javascript,gruntjs,grunt-contrib-uglify

you need grunt-contrib-uglify for the excluding files requirement: http://gruntjs.com/configuring-tasks#files...

How to prevent grunt-uglify to mess with angularJS scope value in directive

javascript,angularjs,gruntjs,grunt-contrib-uglify

You have to annotate the controller function too: controller: ['$scope', function($scope) { // your function }] So your full code becomes: OfficeSuiteModule.directive('officeButton', ['$q', 'stylesheetInjectorService', function($q, stylesheetInjectorService) { return { restrict: 'E', replace: true, scope: { isDisabled: '@?', label: '@?', api: '=' }, template: OFFICE_BUTTON_TEMPLATE, // Defines the controller for the...

Uglify can't parse “flow.js”

bower,grunt-usemin,grunt-contrib-uglify,angular-fullstack,ng-flow

The problem is that Grunt can't distinguish between a directory ending in '.js' and a .js file. The workaround will be to use a wildcard expression to grab the files in flow.js and to exclude the directory itself. Edit: You will need to exclude flow.js from both usemin AND rev....

Complex gruntjs tasks

gruntjs,grunt-contrib-concat,grunt-contrib-uglify

In grunt you can only define the config for a task once, but you can define multiple targets (with different names). So in your case you need to define two targets under the 'concat' task and then call them in sequence: module.exports = function(grunt) { grunt.initConfig({ pkg:grunt.file.readJSON('package.json'), concat: { step1:...

Grunt Uglify get sum of space saved

javascript,node.js,gruntjs,grunt-contrib-uglify

A simple method would be to write your own task that used the nodejs file system library to list out the sizes of the files you want to compare using fs.Stats. A more complex option would be to log both the pre and post sizes to a file with a...

Stop Grunt Contrib Uglify from removing unused Javascript

javascript,gruntjs,grunt-contrib-uglify

Set options: unused to false grunt.initConfig({ uglify: { options: { compress: { unused: false } }, my_target: { files: { 'dest/output.min.js': ['src/input.js'] } } } }); Source: UglifyJS global definitions documentation unused : true, // drop unused variables/functions...

Uglify with sourceMap option enabled don't match the filerev js file it should reference

gruntjs,yeoman,grunt-contrib-uglify

Finally, I updated all my packages and all goes smoothly. Here after my uglify task : uglify: { options : { sourceMap : true, compress : {}, mangle : true } } Here after an extract of my package.json { "grunt": "^0.4.5", "grunt-autoprefixer": "^2.2.0", "grunt-concurrent": "^1.0.0", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-concat": "^0.5.0",...

new to grunt - warning: task “concat, uglify” not found

javascript,node.js,gruntjs,grunt-contrib-concat,grunt-contrib-uglify

Your passing in only one string for the registerTask task list. It should be a comma separated list of strings like: grunt.registerTask('default', ['concat', 'uglify']); You're getting that error because it's looking for a task named 'concat, uglify'....

Grunt hangs on uglify

node.js,gruntjs,minify,grunt-contrib-uglify

You're redefining the uglify task to run itself in your last line, replacing grunt-contrib-uglify: grunt.registerTask('uglify', ['uglify']); That's why your grunt is looping endlessly. Just give it a different name: grunt.registerTask('compress', ['uglify']); ...

Multiple destination directories using Uglify

gruntjs,uglifyjs,grunt-contrib-uglify

Managed to find out what I wanted to do based on this SO question: How to grunt-uglify multiple script files while keeping folder structure I wound up with the following rename function: files: grunt.file.expandMapping(['**/amd/src/*.js', '!**/node_modules/**'], '', { rename: function(destBase, destPath) { destPath = destPath.replace('src', 'build'); destPath = destPath.replace('.js', '.min.js'); return...

Grunt Uglify produces code that browsers do not agree with

javascript,grunt-contrib-uglify

It causes an error in Chrome because your original code is invalid. What you are actually doing is assign the result of alert("Test") to window.test. alert returns undefined, so when you are attempting to call test later on, it references undefined instead of a function. You're also missing an opening...