Django-css for Linux v.2.2.1

Advertisement
Advertisement

django-css is a fork of the django_compressor app 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.Thanks 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.Note: 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/masterInstallationAdd 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.UsageSyntax:{% load compress %}{% compress %}{% endcompress %}Examples:{% load compress %}{% compress css %}{% endcompress %}Which would be rendered like:or:{% load compress %}{% compress js %}obj.value = "value";{% endcompress %}Which would be rendered like:If you're using xhtml, you should use:{% load compress %}{% compress css xhtml %}{% compress css %}Which would be rendered like:SettingsCOMPILER_FORMATS default: {} A dictionary specifying the compiler and arguments to associate with each extension.django-css will select which CSS compiler to use based off a file's extension. For example:COMPILER_FORMATS = { '.sass': { 'binary_path':'sass', 'arguments': '*.sass *.css' }, '.hss': { 'binary_path':'/home/dziegler/hss', 'arguments':'*.hss' }, '.ccss': { 'binary_path':'clevercss', 'arguments': '*.ccss' },}will 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.binary_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.arguments 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.If 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.COMPRESS default: the opposite of DEBUG Boolean that decides if compression will happen.COMPRESS_CSS_FILTERS default: [] A list of filters that will be applied to CSS.COMPRESS_JS_FILTERS default: ['compressor.filters.jsmin.JSMinFilter']) A list of filters that will be applied to javascript.COMPRESS_URL default: MEDIA_URL Controls the URL that linked media will be read from and compressed media will be written to.COMPRESS_ROOT default: MEDIA_ROOT Controls the absolute file path that linked media will be read from and compressed media will be written to.COMPRESS_OUTPUT_DIR default: "CACHE" Controls the directory inside COMPRESS_ROOT that compressed files will be written to.NotesAll relative url() bits specified in linked CSS files are automatically converted to absolute URLs while being processed. Any local absolute urls (those starting with a '/') are left alone.Stylesheets that are @import'd are not compressed into the main file. They are left alone.Set the media attribute as normal on your and elements and the combined CSS will be wrapped in @media blocks as necessary.Linked files must be on your COMPRESS_URL (which defaults to MEDIA_URL). If DEBUG is true off-site files will throw exceptions. If DEBUG is false they will be silently stripped.CSS files are compiled only when needed, because it would be silly to re-compile on every page request. The way this works is that django-css looks at the time your css was last modified, and the time your CleverCSS, HSS, etc file was modified. If the modification time for the CleverCSS, HSS, etc file is after the css file's, then the css file gets re-compiled.If COMPRESS is False (defaults to the opposite of DEBUG) CSS files will still be compiled if needed, but files will not be compressed and versioned.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#md5=b4ab5e9a8d0079abafdbf0d5e67c579d

django-css is a fork of the django_compressor ... django-css provides an easy way to use CSS compilers with Django projects, and an automated system for compressing CSS and javascript files ...

 
  • Django-css for Linux
  • 2.2.1
  • David Ziegler
  • Linux
  • Freeware
  • 10 Kb
  • 222
  • Free
 
 

Review Django-css for Linux

  • captcha
 

Other software of David Ziegler

New Misc software
  • NetLimiter  v.4.0.51NetLimiter gives you full network control over your computer. You will decide where your applications are allowed to connect and how fast these connections should be.
  • USB Network Gate for Linux  v.5.0USB Network Gate for Linux is perfect for working with a remote USB device over the network. The device appears to the remote machine as if it was plugged into it directly.
  • Net Viewer  v.9.3Organize thousands of Web Sites by Categories, priorities, search words, and Users in a secure database. Collect Web Sites automatically while browsing the internet using multiple Browser Windows. Save EMail and Passwords in the database.