{ "info": { "author": "Davide Moro", "author_email": "davide.moro@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Pyramid", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application" ], "description": "pyramid_html_minifier\n=====================\n\n|build status|_\n|code coverage|_\n\n.. |build status| image:: https://secure.travis-ci.org/davidemoro/pyramid_html_minifier.png?branch=master\n.. _build status: http://travis-ci.org/davidemoro/pyramid_html_minifier\n.. |code coverage| image:: http://codecov.io/github/davidemoro/pyramid_html_minifier/coverage.svg?branch=master\n.. _code coverage: http://codecov.io/github/davidemoro/pyramid_html_minifier?branch=master\n\n``pyramid_html_minifier`` introduces *safe* html minification\nwith *no overhead* for ``Pylons/Pyramid`` applications powered by:\n\n* ``Chameleon`` templates (``ZPT`` based template implementation). ``Chameleon``\n templates are still valid ``XML``, so they can be safely minified with not\n too aggressive minification options\n\nWhat you get with pyramid_html_minifier\n---------------------------------------\n\n* **bandwith and performance.** Save precious kilobytes (~50-80% depending on your templates).\n It is quite important for bandwith usage and improved performance,\n even more important if you have to manage a big and fat\n ``Pylons/Pyramid`` based website with a lot of traffic.\n See https://www.npmjs.com/package/html-minifier\n\n* **no overhead.** The minification is based on a build step (a sort of\n gulp/grunt based collectstatic). So no minification on the fly\n\n* **safe template/html minification**. It works even with ``macros``\n and ``slots``.\n This pattern has been adopted on production websites with no issues\n after 1 year. So I dare say it is a safe pattern after a\n 1-year quarantine without any sort of problems. You should only\n remember to disable too aggressive minification options (see next\n sections)\n\nWhat pyramid_html_minifier does\n-------------------------------\n\nWhat ``pyramid_html_minifier`` introduces:\n\n* a custom ``.html`` renderer (interpreted as ``Chameleon`` templates)\n\n* support for ``dist`` vs ``app``, commonly used in ``Yeoman``\n projects. ``app`` will be used for development, while ``dist``\n in production mode (based on a template minification build).\n\nThis way you can start developing static mock applications (even\nheavily Javascript based) using the ``Yeoman`` workflow and use your\nmodified html files enriched by macros and slots as ``Chameleon``\ntemplates.\n\nHow to use pyramid_html_minifier\n--------------------------------\n\nHere you can see how to enable Chameleon templates minification in your\n``Pylons/Pyramid`` web application:\n\n* put your ``Chameleon`` template file in ``templates/app/master.html`` and its\n minified version in ``templates/dist/master.html`` (the ``.html`` extension is\n important). Obviously don't do minification by hand, add ``Yeoman`` in your\n development workflow with its related tools for automation.\n This package does not provide any ``gulp`` or ``grunt`` configuration,\n you are supposed to create your own setup\n\n* register a normal ``Pylons/Pyramid`` callable view with\n ``renderer=\"your_plugin:templates/{0}/master.html\"``. The ``{0}`` is only\n a placeholder that ``pyramid_html_minifier`` will fill depending on your\n settings. See next step\n\n* tell ``pyramid_html_minifier`` if you want to pick up standard templates or\n minified ones adding the ``pyramid_html_minifier.placeholder`` setting to your\n ``.ini`` file. Typical value for development is ``app`` (the default one),\n while ``dist`` is usually used for prodcution environments.\n Example: ``pyramid_html_minifier.placeholder = dist``\n\n* add ``pyramid_html_minifier`` to your pyramid.includes setting\n\nThe final .ini file should looks like the following one::\n\n pyramid.includes =\n ...\n pyramid_html_minifier\n \n ...\n \n pyramid_html_minifier.placeholder = dist\n\nSafe minification options\n-------------------------\n\nI suggest to automate the build process integrating the ``Yeoman`` workflow into your\n``Pylons/Pyramid`` project for the best developing experience.\n\nI suggest to use the ``html-minifier`` minificator and its friend ``gulp-html-minifier``\ndisabling too aggressive html minification options.\n\nIn particular be sure that the ``keepClosingSlash`` option is enabled and\n``removeAttributeQuotes`` is disabled.\n\nHere you can see a real example working configuration::\n\n const htmlMinifierOptions = {\n collapseBooleanAttributes: true,\n collapseWhitespace: true,\n removeComments: true,\n removeCommentsFromCDATA: true,\n removeEmptyAttributes: true,\n removeRedundantAttributes: true,\n useShortDoctype: true,\n keepClosingSlash: true,\n }\n \n ...\n \n gulp.task('html', ['styles'], () => {\n const assets = $.useref.assets({searchPath: ['.tmp', 'app', '.']});\n \n return gulp.src('app/*.html')\n ..\n .pipe($.if('*.html', $.htmlMinifier(htmlMinifierOptions)))\n ...\n .pipe(gulp.dest('dist'));\n\nWhy Yeoman\n----------\n\nWhy ``Yeoman``:\n\n* better and more modern web development experience\n\n* minification and/or resources concatenation (images, css, Javascript)\n\n* more. See http://yeoman.io/\n\nLinks\n-----\n\nHere you can find a project using ``pyramid_html_minifier``:\n\n* https://github.com/Kotti/kotti_frontend\n\nMore details about case studies using the same pattern:\n\n* http://davidemoro.blogspot.it/2014/09/plone-angularjs-yeoman-starter.html\n\n* http://davidemoro.blogspot.com/2014/09/pyramid-starter-seed-yeomam-part-1.html\n\n* http://davidemoro.blogspot.it/2013/08/yeoman-express-and-angularjs.html\n\nAuthors\n-------\n\n* Davide Moro (https://twitter.com/davidemoro)\n\n\n0.1 (2015-08-03)\n----------------\n\n- Initial version", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidemoro/pyramid_html_minifier", "keywords": "web pyramid pylons", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "pyramid_html_minifier", "package_url": "https://pypi.org/project/pyramid_html_minifier/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyramid_html_minifier/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/davidemoro/pyramid_html_minifier" }, "release_url": "https://pypi.org/project/pyramid_html_minifier/0.1/", "requires_dist": null, "requires_python": null, "summary": "pyramid_html_minifier", "version": "0.1" }, "last_serial": 1661845, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "674768c4b305ec4ba90c6e01499a8692", "sha256": "81689dfb584e4e857f2a55d4b492f3555c0e0dbd6c4441386b9c578ded9d6ce2" }, "downloads": -1, "filename": "pyramid_html_minifier-0.1.tar.gz", "has_sig": false, "md5_digest": "674768c4b305ec4ba90c6e01499a8692", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6972, "upload_time": "2015-08-03T12:46:07", "url": "https://files.pythonhosted.org/packages/4f/b6/b1538707d8b7991e278cea9c4c8957aca7c429cf9ca17f7f585974127d88/pyramid_html_minifier-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "674768c4b305ec4ba90c6e01499a8692", "sha256": "81689dfb584e4e857f2a55d4b492f3555c0e0dbd6c4441386b9c578ded9d6ce2" }, "downloads": -1, "filename": "pyramid_html_minifier-0.1.tar.gz", "has_sig": false, "md5_digest": "674768c4b305ec4ba90c6e01499a8692", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6972, "upload_time": "2015-08-03T12:46:07", "url": "https://files.pythonhosted.org/packages/4f/b6/b1538707d8b7991e278cea9c4c8957aca7c429cf9ca17f7f585974127d88/pyramid_html_minifier-0.1.tar.gz" } ] }