minify

Debug source maps loading on Chrome

廉价感情. 提交于 2020-01-03 18:43:08
问题 I generate source maps for javascript files during minification. The map files are referenced using a relative URL from the minified JS files that sit next to the map files. Here is an example comment at the end of app-e47a6637.js : //# sourceMappingURL=app-e47a6637.js.map The source map resolution works as expected in Firefox. However, Chrome does not load the map files. Additional information: JS source maps are of course enabled in the settings. I tried putting a proxy between Chrome and

Webpack not minifying my bundle js

旧巷老猫 提交于 2020-01-03 02:59:16
问题 I'm now bundling my first project with webpack, everything works as expected except webpack is not minifying my bundle.min.js code. I'm pretty sure I'm doing something wrong, but can't spot the mistake. Any help would be appreciated. Thanks in advance. Here I go w/ my webpack.config.js var webpack = require("webpack"); var ExtractTextPlugin = require("extract-text-webpack-plugin"); var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); module.exports = { context: _

Eclipse (STS), Maven and maven-minify-plugin, can they work together?

 ̄綄美尐妖づ 提交于 2020-01-02 12:14:08
问题 I am working on a project where I am in charge of html, css and javascript. I found this maven-minify-plugin that seemed to just what I wanted. Everything is good when I deploy using maven on the server, but when I am using Eclipse (STS, www.springsource.com/products/sts) to run the project on localhost no css nor js file is generated by the plugin. Does anyone have experience with this Maven plugin, so they can tell me if it should be possible or not run on localhost? Does anyone have

Minified JSON in flask's jsonify()

冷暖自知 提交于 2020-01-02 06:15:29
问题 Flask offers the convenient jsonify() function, which returns a JSON object from Python variables: from flask import Flask, jsonify app = Flask(__name__) @app.route("/") def json_hello(): return jsonify({x:x*x for x in range(5)}), 200 if __name__ == "__main__": app.run(debug=True) Which returns: { "0": 0, "1": 1, "2": 4, "3": 9, "4": 16 } (PS - note the conversion from int to string to comply with JSON). This indented format is wasteful for long outputs, and I prefer the minified version: {"1

Combine and minify all bower libraries with gruntjs

谁说我不能喝 提交于 2020-01-01 09:57:14
问题 Is there a way to combine and minify all bower installed libraries into 1 file automatically? First I tried the most basic approach: combine all .js files from all subdirectories: uglify: { options: {compress: true}, my_target: { files: { 'vendor.js': ['bower_components/**/*.js'], } } } But this is obviously a bad approach. It also doesn't work because of too many errors. I manually deleted all the files and kept only 1 (main) file that each library has, and it worked. Is there a way to do

Javascript minification why is false replaced with !1 and true with !0 [duplicate]

≡放荡痞女 提交于 2020-01-01 07:58:05
问题 This question already has an answer here : Is there any point of using “return !0” in javascript? (1 answer) Closed 3 years ago . I'm writing an app using Enyo2 which comes with a minification tool based on UglifyJS. I've noticed that: var t = false is replaced with var t=!1 The same way true is replaced with !0. I'm sure there is a good explanation for that, I just can't find it. Any idea? 回答1: There is one apparently. If you use 1 or 0 to translate true or false, it would be shorter but

Javascript minification why is false replaced with !1 and true with !0 [duplicate]

天大地大妈咪最大 提交于 2020-01-01 07:57:04
问题 This question already has an answer here : Is there any point of using “return !0” in javascript? (1 answer) Closed 3 years ago . I'm writing an app using Enyo2 which comes with a minification tool based on UglifyJS. I've noticed that: var t = false is replaced with var t=!1 The same way true is replaced with !0. I'm sure there is a good explanation for that, I just can't find it. Any idea? 回答1: There is one apparently. If you use 1 or 0 to translate true or false, it would be shorter but

Is minifying your HTML, CSS, and Javascript a bad idea?

南笙酒味 提交于 2020-01-01 01:15:36
问题 Wikipedia defines minification as... [...] the process of removing all unnecessary characters from source code without changing its functionality. These unnecessary characters usually include white space characters, new line characters, comments, and sometimes block delimiters, which are used to add readability to the code but are not required for it to execute. I'm currently doing this to my HTML, CSS and Javascript in order to save bandwidth, but someone told me that he remembers a browser

Django-compressor and template inheritance

旧城冷巷雨未停 提交于 2019-12-31 22:38:53
问题 I'm using the django-compressor app in Django 1.2.3 to minify and merge a number of included CSS and JS files. In a base template, I have {% load compress %} {% compress js %} {% block js %} <script type="text/javascript" src="/site_media/js/jquery.query-2.1.7.js"> {% endblock %} and in a child, {% block js %} {{block.super}} <script type="text/javascript" src="/site_media/js/jquery.validate.min.js"> {% endblock %} When the templates render, the first script tag is correctly minified, but the

Django-compressor and template inheritance

♀尐吖头ヾ 提交于 2019-12-31 22:38:11
问题 I'm using the django-compressor app in Django 1.2.3 to minify and merge a number of included CSS and JS files. In a base template, I have {% load compress %} {% compress js %} {% block js %} <script type="text/javascript" src="/site_media/js/jquery.query-2.1.7.js"> {% endblock %} and in a child, {% block js %} {{block.super}} <script type="text/javascript" src="/site_media/js/jquery.validate.min.js"> {% endblock %} When the templates render, the first script tag is correctly minified, but the