django-compressor-toolkit
django-compressor-toolkit copied to clipboard
Command Error: An error occurred during rendering
Full text of the error Compressing... CommandError: An error occurred during rendering posts\compilations.html: 'utf-8' codec can't decode byte 0x8f in position 0: invalid start byte. At each compression attempt, the filename "compilations.html " miscellaneous. The error occurs when i add type="text/x-scss".
settings.py
COMPRESS_ENABLED = True
COMPRESS_CSS_HASHING_METHOD = 'content'
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
COMPRESS_FILTERS = {
'css': [
'compressor.filters.css_default.CssAbsoluteFilter',
'compressor.filters.cssmin.rCSSMinFilter',
],
'js': [
'compressor.filters.jsmin.JSMinFilter',
]
}
COMPRESS_PRECOMPILERS = (
('text/x-scss', 'compressor_toolkit.precompilers.SCSSCompiler'),
('module', 'compressor_toolkit.precompilers.ES6Compiler'),
)
HTML_MINIFY = True
KEEP_COMMENTS_ON_MINIFYING = True
COMPRESS_OFFLINE = True
package.json
{
"name": "name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"type": "module",
"author": "",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^10.4.14",
"babel-preset-es2015": "^6.24.1",
"babelify": "^10.0.0",
"browserify": "^17.0.0",
"node-sass": "^8.0.0",
"postcss-cli": "^10.1.0",
"sass": "^1.59.3"
},
"dependencies": {
"jquery": "^3.6.4"
}
}
html
{% load static %}
{% load compress %}
{% compress css %}
<link rel="stylesheet" type="text/x-scss" href="{% static '/sass/styles.scss' %}">
{% endcompress %}