minify

Generate Javascript file with PHP

女生的网名这么多〃 提交于 2019-12-19 03:08:47
问题 My current code I have started writing an API that loads, minifies and returns javascript files into one file using PHP. This is achieved by pointing to a PHP file from a script tag in HMTL like so: <script type="text/javascript" src="https://libraries.sinemaculammviii.com/jsapi.php"></script> This jsapi.php page processes the javascript files and outputs the minified javascript, with the header: header("Content-Type: text/javascript"); My Question Is this a bad method to load javascript

Minification is breaking my AngularJs code

倖福魔咒の 提交于 2019-12-19 01:46:08
问题 I'm using Cassette which uses the Microsoft Ajax Minifier to minify JS. This minifier renames variables, including variables that have special meaning to Angular, such as $scope and $http . So Cassette breaks my Angular code! How can I prevent this happening? For reference, this is the Angular code which is being broken. The $scope and $http function parameters are being renamed: // <reference path="vendor/angular.js" /> angular.module('account-module', []) .controller(

Maven Javascript Compressor

喜欢而已 提交于 2019-12-18 21:19:10
问题 I want to know how one can compress javascriptfiles using maven. I have lready visited webistes like http://mojohaus.org/javascript-maven-tools/guide-webapp-development.html but there is no implementation explained. I want to know the dependency for executing the maven plugin. 回答1: I suggest using the YUI Compressor Maven Mojo and its yuicompressor:compress goal instead. It is well documented, it just works. To use it, add the following pluginRepository : <pluginRepositories>

Is it better to minify javascript into a single bundle for the whole site, or a specific-to-each-page bundle?

坚强是说给别人听的谎言 提交于 2019-12-18 18:42:03
问题 When minifying JavaScripts together in web-development, is it better from the user-loading-time point of view to: make one single big bundle of JavaScript containing all the script, and include this on each page - so each page will probably not need all of it, but once the user has it cached, they don't need to get any further scripts (until it expires from their cache, of course) - optimising for number-of-requests make one bundle of JavaScript per page, so that each page loads just the

Grunt task(s) to minify single HTML file with CSS and Javascript

元气小坏坏 提交于 2019-12-18 16:49:40
问题 I'm doing a login page which I want to be as lightweight as possible for the quickest possible loading time. I have a single dependency (a configuration file) and everything else is coded on a single html file, called index.html . Although I have no problem in minifying JS, HTML and CSS seperately, e.g, in their respective .js, .html and .css files, I can't seem to find a way to minify a single html file which contains the 3 different aspects. For the HTML I'm using grunt-contrib-htmlmin but

How to minify HTML?

瘦欲@ 提交于 2019-12-18 12:58:10
问题 Is there some tool (or Rails itself) that can minify HTML (like what Jammit does for CSS and JS files) ? Secondarily, what is the best practice here, and is it even worth minifying the html? (this is for a site that will be served to mobile phones, so keeping weight down is important) 回答1: Enabling compression at HTTP level will serve you much more than minifying HTML, however tidy is good to apply transformations to HTML, including removing extraneous spaces , comments, etc... 回答2: Well, you

How to combine (minify) compiled Angular 2 components?

十年热恋 提交于 2019-12-18 12:52:50
问题 trying to minify compiled source code of a project for production, I'm using Gulp as the task runner. the source files look like this, html <!--... . . various scripts and styles . . . . . ---> <script src="node_modules/angular2/bundles/angular2.dev.js"></script> <script src="node_modules/angular2/bundles/router.dev.js"></script> <script src="node_modules/angular2/bundles/http.dev.js"></script> <script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' } } });

Why is Magento 1.4 including javascript files by filesystem path?

六眼飞鱼酱① 提交于 2019-12-18 11:59:09
问题 I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so: <script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script> I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and

MVC4 Beta Minification and Bundling: Ordering files and debugging in browser

*爱你&永不变心* 提交于 2019-12-18 11:52:29
问题 I've started using bundling and minification included with the MVC4 Beta. I'm running into a few issues with it: For one thing, if I use the classic <script src="Folder/js" type="text/javascript"/> bundling, it seems like I have to rename my files to make sure they're bundled in the proper order. Let's say I have three javascript files: "ants.js", "bugs.js", "insects.js" ants.js depends on bugs.js bugs.js depends on insects.js Default bundling seems to bundle them in alphabetical order. To

Django: auto minifying css/js files before release

隐身守侯 提交于 2019-12-18 11:11:14
问题 I have following case: I want to use uncompressed js/css files during development (to debug js for example) but on production I want to switch automatically to minified versions of that files. some simple solution is to put in your template: <script src="some_js.{% if not debug %}min.{% endif %}js".... but this require manully providing that such file exist and to do minifaction manullay after original file change. How do you accomplish this in your projects? Is there any tool for this? 回答1: