Is there an alternative to the Rails pipeline for Django?

Using the Rails asset pipeline and the plugin for require.js, I can use the CoffeeScript, SASS files that I like, and all this is compiled for one JavaScript and one CSS file for production. Is there a suitable setting for use with Django? It should support the above, CofeeeScript, SASS, Require.JS with a development mode where the files are serviced individually, as well as a production mode where everything is compiled into separate files.

+6
source share
1 answer

I am using Django Compressor and I am very pleased with this. It supports pre-processors, so Coffeescript, Sass, etc. are supported. Check the documentation.

EDIT: Here are my settings for SASS and Coffeescript, in settings.py:

STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder', ) COMPRESS_PRECOMPILERS = ( ('text/coffeescript', 'coffee --compile --stdio'), ('text/x-sass', 'sass {infile} {outfile}'), ('text/x-scss', 'sass --scss {infile} {outfile}'), ) 
+7
source

Source: https://habr.com/ru/post/910398/


All Articles