Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow LESS css files for compression that will be used on the client #26

Closed
supercodepoet opened this issue Apr 14, 2011 · 2 comments
Closed
Labels

Comments

@supercodepoet
Copy link

If you want to allow the less.js to parse the LESS css files on the client you need to set the rel attribute to stylesheet/less. Doing this makes django-compressor skip the files as it looks for rel="stylesheet". It would be great to have a CSS_COMPRESSOR that we could configure that would assume the files are LESS and compress them and out put one link element with the rel set to stylesheet/less so that less.js will parse the compressed file.

@jezdez
Copy link
Member

jezdez commented Apr 14, 2011

I'm not convinced that this should be an own feature of the compressor, but you can override the used CSS compressor class with the COMPRESSOR_CSS_COMPRESSOR setting. Refactoring the default CssCompressor class to easier define what should be considered a file to compress wouldn't be hard (e.g. elem_<elem_name> method hooks that could be re-implemented in an own subclass).

@supercodepoet
Copy link
Author

This is what I actually ended up doing. It was basically the exact same as the CssProcessor but allowing stylesheet/less when parsing the files and a new template that outputs the link element with a rel="stylesheet/less". This worked really well and allowed the less.js file to parse the resulting compressed file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants