ndparker / rcssmin Goto Github PK
View Code? Open in Web Editor NEWFast CSS minifier for Python
Home Page: http://opensource.perlig.de/rcssmin/
License: Apache License 2.0
Fast CSS minifier for Python
Home Page: http://opensource.perlig.de/rcssmin/
License: Apache License 2.0
For example, if you do this:
body {
width: calc(90% + 10px);
}
rcssmin will output:
body{width:calc(90%+10px)}
This breaks things, because the browser wants the spaces to stay around +. A temporary work-around, if people want it, that doesn't get the required spaces removed is a double negative:
body {
width: calc(90% - -10px);
}
which outputs:
body{width:calc(90% - -10px)}
It you give the following css to cssmin
@import url('https://fonts.googleapis.com/css?family=Open Sans:700');"
it converts it to
@import url('https://fonts.googleapis.com/css?family=OpenSans:700');"
which messes up the font import.
Minifying this particular bootstrap 4 beta css rule produces the following output:
.navbar-light .navbar-toggler-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}
.navbar-light .navbar-toggler-icon{background-image:url("data:image/svg+xml;charset=utf8,%3CsvgviewBox=\'003030\'xmlns=\'http://www.w3.org/2000/svg\'%3E%3Cpathstroke=\'rgba(0,0,0,0.5)\'stroke-width=\'2\'stroke-linecap=\'round\'stroke-miterlimit=\'10\'d=\'M47h22M415h22M423h22\'/%3E%3C/svg%3E")}
Which is incorrect. For some reason, the string quotes are not being respected and their contents are being minified.
Hello,
i tried it with python 3.5 and it works well so far. So maybe you can consider to change the build config and increment the python version, same as for rjsmin!
Thx!
When I try to install the package, I get the following error:
Collecting rcssmin
Using cached https://files.pythonhosted.org/packages/e2/5f/852be8aa80d1c24de9b030cdb6532bc7e7a1c8461554f6edbe14335ba890/rcssmin-1.0.6.tar.gz
Building wheels for collected packages: rcssmin
Running setup.py bdist_wheel for rcssmin: started
Running setup.py bdist_wheel for rcssmin: finished with status 'error'
Complete output from command C:\Users\xxx\.virtualenvs\xxxxxx\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxx\\AppData\\Local\\Temp\\pycharm-packaging\\rcssmin\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\FRANTI~1\AppData\Local\Temp\pip-wheel-3d3cxpnq --python-tag cp37:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win32-3.7
copying .\rcssmin.py -> build\lib.win32-3.7
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_rcssmin' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DEXT_MODULE=_rcssmin -UEXT_PACKAGE -I_setup/include -IC:\Users\xxx\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\xxx\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" /Tcrcssmin.c /Fobuild\temp.win32-3.7\Release\rcssmin.obj
rcssmin.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\Libs /LIBPATH:C:\Users\xxx\.virtualenvs\xxxxxx\libs /LIBPATH:C:\Users\xxx\.virtualenvs\xxxxxx\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86" /EXPORT:PyInit__rcssmin build\temp.win32-3.7\Release\rcssmin.obj /OUT:build\lib.win32-3.7\_rcssmin.cp37-win32.pyd /IMPLIB:build\temp.win32-3.7\Release\_rcssmin.cp37-win32.lib
Creating library build\temp.win32-3.7\Release\_rcssmin.cp37-win32.lib and object build\temp.win32-3.7\Release\_rcssmin.cp37-win32.exp
Generating code
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\link.exe' failed with exit status 1158
----------------------------------------
Running setup.py clean for rcssmin
Failed to build rcssmin
Installing collected packages: rcssmin
Running setup.py install for rcssmin: started
Running setup.py install for rcssmin: finished with status 'error'
Complete output from command C:\Users\xxx\.virtualenvs\xxxxxx\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxx\\AppData\\Local\\Temp\\pycharm-packaging\\rcssmin\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\FRANTI~1\AppData\Local\Temp\pip-record-5i196jna\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\xxx\.virtualenvs\xxxxxx\include\site\python3.7\rcssmin:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying .\rcssmin.py -> build\lib.win32-3.7
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_rcssmin' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DEXT_MODULE=_rcssmin -UEXT_PACKAGE -I_setup/include -IC:\Users\xxx\AppData\Local\Programs\Python\Python37-32\include -IC:\Users\xxx\AppData\Local\Programs\Python\Python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt" /Tcrcssmin.c /Fobuild\temp.win32-3.7\Release\rcssmin.obj
rcssmin.c
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\Libs /LIBPATH:C:\Users\xxx\.virtualenvs\xxxxxx\libs /LIBPATH:C:\Users\xxx\.virtualenvs\xxxxxx\PCbuild\win32 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\ucrt\x86" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17134.0\um\x86" /EXPORT:PyInit__rcssmin build\temp.win32-3.7\Release\rcssmin.obj /OUT:build\lib.win32-3.7\_rcssmin.cp37-win32.pyd /IMPLIB:build\temp.win32-3.7\Release\_rcssmin.cp37-win32.lib
Creating library build\temp.win32-3.7\Release\_rcssmin.cp37-win32.lib and object build\temp.win32-3.7\Release\_rcssmin.cp37-win32.exp
Generating code
Finished generating code
LINK : fatal error LNK1158: cannot run 'rc.exe'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\link.exe' failed with exit status 1158
----------------------------------------
Failed building wheel for rcssmin
Command "C:\Users\xxx\.virtualenvs\xxxxxx\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\xxx\\AppData\\Local\\Temp\\pycharm-packaging\\rcssmin\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\FRANTI~1\AppData\Local\Temp\pip-record-5i196jna\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\xxx\.virtualenvs\xxxxxx\include\site\python3.7\rcssmin" failed with error code 1 in C:\Users\xxx\AppData\Local\Temp\pycharm-packaging\rcssmin\
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
This package seems to break in newer versions of pip or setuptools.
$ pip install rcssmin
Collecting rcssmin
Using cached rcssmin-1.0.6.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/rcssmin.egg-info
writing pip-egg-info/rcssmin.egg-info/PKG-INFO
writing top-level names to pip-egg-info/rcssmin.egg-info/top_level.txt
writing dependency_links to pip-egg-info/rcssmin.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/rcssmin.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-vvpy33ni/rcssmin/setup.py", line 42, in <module>
setup()
File "/tmp/pip-build-vvpy33ni/rcssmin/setup.py", line 33, in setup
return run(script_args=args, ext=ext, manifest_only=_manifest)
File "/tmp/pip-build-vvpy33ni/rcssmin/_setup/py3/setup.py", line 426, in run
return _core.setup(**kwargs)
File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 279, in run
self.find_sources()
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 306, in find_sources
mm.run()
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 533, in run
self.add_defaults()
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/egg_info.py", line 562, in add_defaults
sdist.add_defaults(self)
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/py36compat.py", line 35, in add_defaults
self._add_defaults_data_files()
File "/home/thom/.pythonenvs/tmp-c88a3d086ff79bc/lib/python3.5/site-packages/setuptools/command/py36compat.py", line 111, in _add_defaults_data_files
dirname, filenames = item
TypeError: 'Documentation' object is not iterable
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vvpy33ni/rcssmin/
I'm getting an error installing rcssmin via django-compressor on my Mac.
Mac OSX: 10.15.7
Xcode: 12.0.1 (command line tools are up-to-date as well)
python: 3.8.2
pip3: 20.2.3
pipenv: 2020.8.13
pyenv: 1.2.21
Here is the full error log:
rcssmin-error.txt
The one thing I see that looks odd is a reference to macosx-10.14.6. It looks like that's talking about my OS version, but I'm actually on 10.15.7, so I'm not sure what's going wrong there.
creating build/lib.macosx-10.14.6-x86_64-3.8
I can install rcssmin with python 3.7 and 3.8.6, but it's not working with 3.8.2.
Can the setup.py be adjusted to fallback to a python only install? Similar to how simplejson does it:
https://github.com/simplejson/simplejson/blob/master/setup.py
Any idea what goes wrong here?
Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. Alle Rechte vorbehalten.
C:\WINDOWS\system32>pip install rcssmin
Collecting rcssmin
Using cached rcssmin-1.0.6.tar.gz
Installing collected packages: rcssmin
Running setup.py install for rcssmin ... error
Complete output from command c:\users\frank\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Frank\\AppData\\Local\\Temp\\pip-build-ivcw8kp9\\rcssmin\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Frank\AppData\Local\Temp\pip-8rrayw7w-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying .\rcssmin.py -> build\lib.win-amd64-3.6
running build_ext
building '_rcssmin' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DEXT_MODULE=_rcssmin -UEXT_PACKAGE -I_setup/include -Ic:\users\frank\appdata\local\programs\python\python36\include -Ic:\users\frank\appdata\local\programs\python\python36\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.15063.0\winrt" /Tcrcssmin.c /Fobuild\temp.win-amd64-3.6\Release\rcssmin.obj
fatal error C1510: Cannot load language resource clui.dll.
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 4
----------------------------------------
Command "c:\users\frank\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Frank\\AppData\\Local\\Temp\\pip-build-ivcw8kp9\\rcssmin\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\Frank\AppData\Local\Temp\pip-8rrayw7w-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Frank\AppData\Local\Temp\pip-build-ivcw8kp9\rcssmin\
C:\WINDOWS\system32>
On my ubuntu bionic system, rcssmin
installed with either python-rcssmin
or python3-rcssmin
doesn't work. The command python -m rcssmin
never ends.
Hello, I faced a bug.
It's removing space inside item path, so
echo '#a .b {}' | python -m rjsmin
producing #a.b{}
instead of #a .b{}
But for some reason it's keeping some of the newlines, while it's not really needed.
see django-compressor/django-compressor#736.
basically, url("../imgs/Credit cards.png")
becomes url("../imgs/Creditcards.png")
, which is wrong :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.