Is there a benefit to minifying JavaScript before gzipping it?

As for raw file size, here is a sample (jQuery 1.4.2): $ curl http://code.jquery.com/jquery-1.4.2.js | gzip > jquery.gz $ curl http://code.jquery.com/jquery-1.4.2.min.js | gzip > jquery-min.gz $ ls -la jquery* -rw-r–r– 1 me staff 24545 Apr 7 12:02 jquery-min.gz -rw-r–r– 1 me staff 45978 Apr 7 12:02 jquery.gz So the minified version is about half the … Read more

Is there a way to rewrite the HTML to use gulp-minified CSS

The best way to handle this is to use one of the HTML injectors from the get-go. I’m using gulp-inject to some success so far. Add gulp-inject to your project: npm i –save-dev gulp-inject Assuming that you have a folder layout similar to this: build/ src/ index.html less/ main.less js/ app.js Your HTML should include … Read more

How do I get the compact/minified form of pretty-printed JSON in Java?

Jackson allows you to read from a JSON string, so read the pretty-printed string back into Jackson and then output it again with pretty-print disabled. See converting a String to JSON. Simple Example String prettyJsonString = “{ \”Hello\” : \”world\”}”; ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readValue(prettyJsonString, JsonNode.class); System.out.println(jsonNode.toString()); Requires <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> … Read more

AngularJS : minification issue in directive

You need to declare a controller as follows: controller: [‘$scope’, function ($scope) { $scope.test = 3; }] Full example here: angular.module(‘person.directives’). directive(“person”, [‘$dialog’, function($dialog) { return { restrict: “E”, templateUrl: “person/views/person.html”, replace: true, scope: { myPerson: ‘=’ }, controller: [‘$scope’, function ($scope) { $scope.test = 3; }] } }]); A solution provided by @Sam would … Read more

tech