From 2095baf02cb0d4d87070352d1d24a1b432c03f30 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 30 Jan 2018 08:05:52 -0500 Subject: [PATCH 1/6] speedup when mincss=no (#54) --- mincss/processor.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mincss/processor.py b/mincss/processor.py index 05119f3..f8ef569 100644 --- a/mincss/processor.py +++ b/mincss/processor.py @@ -159,12 +159,14 @@ def process(self, *urls): for identifier in sorted(self.blocks.keys()): content = self.blocks[identifier] - processed = self._process_content(content, self._bodies) + no_mincss = identifier[-1] + if no_mincss: + processed = content + else: + processed = self._process_content(content, self._bodies) if identifier[1] == INLINE: - line, _, url, no_mincss = identifier - if no_mincss: - processed = content + line, _, url, _ = identifier self.inlines.append( InlineResult( line, @@ -174,9 +176,7 @@ def process(self, *urls): ) ) else: - _, _, url, href, no_mincss = identifier - if no_mincss: - processed = content + _, _, url, href, _ = identifier self.links.append( LinkResult( href, From 9c4e6e0c560db97397e810e5bb6e54d28b12e802 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 30 Jan 2018 08:06:45 -0500 Subject: [PATCH 2/6] version 0.11.5 --- mincss/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mincss/__init__.py b/mincss/__init__.py index 8e747cc..eebcbfe 100644 --- a/mincss/__init__.py +++ b/mincss/__init__.py @@ -1 +1 @@ -__version__ = '0.11.4' +__version__ = '0.11.5' From 371aac74238d810f7328bac1e393883d64b8a636 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 30 Jan 2018 08:13:15 -0500 Subject: [PATCH 3/6] ignore more --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 57ac9b1..22875f1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ mincss.egg-info/ simple.js *.pyc __pycache__/ +.cache/ +.eggs/ From 715a48fbdaaa180fe8cb795716345c2b71e65426 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 8 Feb 2018 08:48:34 -0500 Subject: [PATCH 4/6] cli supports --version --- mincss/__init__.py | 2 +- mincss/main.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mincss/__init__.py b/mincss/__init__.py index eebcbfe..94f8ab8 100644 --- a/mincss/__init__.py +++ b/mincss/__init__.py @@ -1 +1 @@ -__version__ = '0.11.5' +__version__ = '0.11.6' diff --git a/mincss/main.py b/mincss/main.py index 5f2f6f0..0f79534 100644 --- a/mincss/main.py +++ b/mincss/main.py @@ -4,10 +4,14 @@ import os import time +from mincss import __version__ from .processor import Processor def run(args): + if args.version: + print(__version__) + return options = {'debug': args.verbose} if args.phantomjs_path: options['phantomjs'] = args.phantomjs_path @@ -64,6 +68,9 @@ def main(): add('--phantomjs-path', action='store', default='', help='Where is the phantomjs executable') + add('--version', action='store_true', + default=False, + help='Prints out the version of mincss') args = parser.parse_args() return run(args) or 0 From f313d9458d8931b800d9121428edf2591811d5ca Mon Sep 17 00:00:00 2001 From: sureshvv Date: Thu, 7 Jun 2018 00:02:07 +0530 Subject: [PATCH 5/6] Discovered empirically. (#56) --- docs/api.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index 01d5a0c..b303e1b 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -51,6 +51,10 @@ API If you for some reason already have the HTML you can jump straight to this method. Note, you still need to provide the URL where you got the HTML from so it can use that to download any external CSS. + + * When calling ``process_url()`` or ``process_html()``, you have to call ``process()`` + at the end without arguments, in order to post process the pages that were + processed individually. The ``Processor`` instance will make two attributes available From b964a38de27e06033a5bd3627217a7a5de8fa536 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 15 Apr 2019 20:34:36 -0400 Subject: [PATCH 6/6] Link to minimalcss --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index 656e6fc..24eaf8f 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,9 @@ +**UPDATE April 2019** + +INSTEAD OF USING THIS, A MUCH BETTER ALTERNATIVE IS https://github.com/peterbe/minimalcss/ WHICH SUPPORTS JAVASCRIPT AND THE CSS PARSING AND TRANSFORMATIONS ARE DONE WITH A PARSED AST. + + + mincss ======