{ "info": { "author": "David Ziegler", "author_email": "david.ziegler@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "Django css\n=================\n\nDjango-css is a fork of django_compressor_ that makes it easy to use CSS compilers with your Django projects. CSS compilers extend CSS syntax to include more powerful features such as variables and nested blocks, and pretty much rock_ all around. Django-css can currently be used with any CSS compiler that can be called from the command line, such as HSS_, Sass_, CleverCSS_, or LESS_.\n\n.. _rock: http://blog.davidziegler.net/post/92203003/css-compilers-rock\n.. _HSS: http://ncannasse.fr/projects/hss \n.. _Sass: http://haml.hamptoncatlin.com/docs/rdoc/classes/Sass.html\n.. _CleverCSS: http://github.com/dziegler/clevercss/tree/master \n.. _LESS: http://lesscss.org/\n.. _django_compressor: http://github.com/mintchaos/django_compressor/tree/master \n\nThanks to django_compressor, django-css will also version and compress linked and inline javascript or CSS into a single cached file. These cached files will get served through whatever frontend server you use for serving static files, because serving static files through Django is just silly.\n\nNote: The pypi version of CleverCSS is buggy and will not work with django-css. Use the updated version on github: http://github.com/dziegler/clevercss/tree/master \n\nInstallation\n************\n\nAdd ``compressor`` to INSTALLED_APPS. You should also enable some type of caching backend such as memcached, e.g. ``CACHE_BACKEND = 'memcached://127.0.0.1:11211/'``. Don't worry, your static files are not being served through Django. The only thing stored in cache is the path to the static file.\n\n\nNEW in v2.2!\n*************\nDjango-css now uses Django's storage backend when saving compressed files. This means that if you're using something like the S3 backend in django-storages_, your compressed files will automatically be saved to S3. If not, everything should function as normal. Check out django-storages_ for more info on custom storage backends.\n\n.. _django-storages: http://code.welldev.org/django-storages/wiki/Home\n\n\nUsage\n*****\n\nSyntax::\n\n {% load compress %}\n {% compress %}\n \n {% endcompress %}\n\nExamples::\n\n {% load compress %}\n {% compress css %}\n \n \n {% endcompress %}\n\nWhich would be rendered like::\n\n \n\nor::\n\n {% load compress %}\n {% compress js %}\n \n \n {% endcompress %}\n\nWhich would be rendered like::\n\n \n\nIf you're using xhtml, you should use::\n\n {% load compress %}\n {% compress css xhtml %}\n \n \n {% compress css %}\n\nWhich would be rendered like::\n\n \n\n\nSettings\n********\n\n`COMPILER_FORMATS` default: {}\n A dictionary specifying the compiler and arguments to associate with each extension. \n\n\ndjango-css will select which CSS compiler to use based off a file's extension. For example::\n\n COMPILER_FORMATS = {\n '.sass': {\n 'binary_path':'sass',\n 'arguments': '*.sass *.css' \n },\n '.hss': {\n 'binary_path':'/home/dziegler/hss',\n 'arguments':'*.hss'\n },\n '.ccss': {\n 'binary_path':'clevercss',\n 'arguments': '*.ccss'\n },\n }\n\n\nwill use Sass to compile `*.sass` files, HSS to compile `*.hss` files, and clevercss to compile `*.ccss` files. `*.css` files will be treated like normal css files. \n\nbinary_path is the path to the CSS compiler. In the above example, sass and clevercss are installed in my path, and hss is located at /home/dziegler/hss.\n\narguments are arguments you would call in the command line to the compiler. The order and format of these will depend on the CSS compiler you use. Prior to compilation, * will be replaced with the name of your file to be compiled.\n\nIf this seems a little hacky, it's because I wanted to make it easy to use whatever CSS compiler you want with as little setup as possible. \n\n\n`COMPRESS` default: the opposite of `DEBUG`\n Boolean that decides if compression will happen.\n\n`COMPRESS_CSS_FILTERS` default: []\n A list of filters that will be applied to CSS.\n\n`COMPRESS_JS_FILTERS` default: ['compressor.filters.jsmin.JSMinFilter'])\n A list of filters that will be applied to javascript.\n\n`COMPRESS_URL` default: `MEDIA_URL`\n Controls the URL that linked media will be read from and compressed media\n will be written to.\n\n`COMPRESS_ROOT` default: `MEDIA_ROOT`\n Controls the absolute file path that linked media will be read from and\n compressed media will be written to.\n\n`COMPRESS_OUTPUT_DIR` default: `\"CACHE\"`\n Controls the directory inside `COMPRESS_ROOT` that compressed files will\n be written to.\n \n`ABSOLUTE_CSS_URLS` default: `True`\n If True, all relative url() bits specified in linked CSS files are automatically\n converted to absolute URLs while being processed. Any local absolute urls (those\n starting with a '/') are left alone.\n\n\nNotes\n*****\n\nStylesheets that are @import'd are not compressed into the main file. They are\nleft alone.\n\nIf the media attribute is set on