minify

Minifying scripts using GruntJs

懵懂的女人 提交于 2019-12-07 11:58:50
问题 I have a couple js files that I can seem to get GruntJs to concat/minify properly. If I do each individually they work fine. If I combine separately then attempt to minify just the combined file it doesn't work either. Here is the error: Any ideas on how to fix this? Or maybe what is causing it? 回答1: There is currently a problem with GruntJs and the BOM I mentioned in the comment of Derick's answer. You can find the issue here: https://github.com/cowboy/grunt/issues/218#issuecomment-6329807

how to rewrite relative url in minified css with cssmin?

旧城冷巷雨未停 提交于 2019-12-07 07:18:02
问题 I've been looking for a solution to my issue and I've found posts with similar problems, but not the same. I have the following folder structure: js └── GUIFramework ├── external └── WaspFramework ├── Core └── GUI └── Controls └── WaspMask ├── css │ └── WaspMask.css └── resources └── default_loader_circle.gif Inside WaspMask.css file I have this rule: .wasp-loader-default { background-image: url("../resources/default_loader_circle.gif"); } Well, I've tried to minify it (combined with other

max size of Minify/Combining JS Files

拥有回忆 提交于 2019-12-07 07:09:46
问题 I'm interested what is max size of Minify/Combining of one file. So I have a multiple js files and I find I need to make around 2-3 portion of files by 3-5 files. 回答1: There is really no hard, golden rule here. Typically, you want to make a page load with as few HTTP requests as possible. However the Ultimate goal is to make a page load as fast as possible. While reducing request count is key, it is not the only factor. For example, if you had a page with one 100k js file, no css, no images,

Removing comments from JS / CSS file using [PHP]

十年热恋 提交于 2019-12-07 06:58:06
问题 I'm building a PHP script to minify CSS/Javascript , which (obviously) involves getting rid of comments from the file. Any ideas how to do this? (Preferably, I need to get rid of /**/ and // comments) 回答1: Pattern for remove comments in JS $pattern = '/((?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:\/\/.*))/'; Pattern for remove comments in CSS $pattern = '!/\*[^*]*\*+([^/][^*]*\*+)*/!'; $str = preg_replace($pattern, '', $str); I hope above should help someone.. REFF : http://castlesblog.com/2010

When I minify css or js, why isn't it all on one line?

混江龙づ霸主 提交于 2019-12-07 06:45:53
问题 I understand that minifying tries to reduce file size by removing whitespace characters. Sometimes things end up on one line, but more often than not, there are multiple lines. I noticed that line breaks happen wherever spaces occur. Wouldn't it be better just to have it all on one line? 回答1: Given the lack of sample code and information about how the minification is being performed, my best guess would be: Whatever you are using to view the code is performing word wrapping and there aren't

Minify HTML using a Node.js module

匆匆过客 提交于 2019-12-07 06:41:10
问题 I have HTML in a variable and before render it and I want to minify it. I know there are console minifiers such as: html-minifier But I want to minify in code, like this: var minifier = require ('some-minifier'); var notMinifiedHtml = "<html>...</html>"; var minifiedHtml = minifier(notMinifiedHtml); But I don't know such some-minifier library... 回答1: The module you specified, html-minifier, already does what you're asking for. This is how it's used: var minify = require('html-minifier')

How can i get source from a minified javascript file?

懵懂的女人 提交于 2019-12-07 06:28:44
问题 I used online YUI Compressor for minifying my javascript file... Now i got minified version of it but i lost the source as i uploaded the source javascript file without taking a copy of it... How can i get source from a minified javascript file? 回答1: You will have to work hard, but as a starting point I would recommend you to reformat and reindent the code, there are out there some tools to do it: JavaScript unpacker and beautifier JavaScript Beautifier That as I said, will give you a

How to use multiple main.js files for RequireJs in Play Framework 2.1.1 Java?

旧城冷巷雨未停 提交于 2019-12-07 05:55:34
问题 I'm building a single-page app using, AngularJs + RequireJs in Play Framework 2.1.1. I have two application sitting inside the same Play server, admin dashboard and normal website. That's why I have two main.js files for Admin Dashboard and Normal website. The application structure looks like this. I got this from public/javascripts We want to separate the two pages that's why we have two main.js files. However, the problem I'm facing right now is that in the root main.js everything is fine.

Disable minification in Grunt (Yeoman)

六眼飞鱼酱① 提交于 2019-12-07 05:28:16
问题 I recently started using GruntJS through Yeoman and I like the idea of Javascript minification, but it presents difficulties during development. I tried to disable uglify,usemin, etc in different combinations in the Gruntfile but everything seems to be dependent on another thing and breaks the process. Is there a simple way to disable minification? I am using the latest versionof Grunt offered by Yeoman to date, I found that older solutions have a different Gruntfile setup than that usd with

CSS minifier for Maven compatible with modern CSS

廉价感情. 提交于 2019-12-07 03:19:21
问题 Can someone point me to a Maven dependency I can add to my POM to minify a file using modern CSS? Before you say to use com.samaxes.maven:minify-maven-plugin , note that it breaks calculated values: https://github.com/samaxes/minify-maven-plugin/issues/161 In fact any CSS minifier based on YUI Compressor will break calculated values: https://github.com/yui/yuicompressor/issues/268 And com.samaxes.maven:minify-maven-plugin /YUI corrupts the file if it contains certain sequences such as the end