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

Command Error: An error occurred during rendering #13

Open
Wemaka opened this issue Mar 17, 2023 · 0 comments
Open

Command Error: An error occurred during rendering #13

Wemaka opened this issue Mar 17, 2023 · 0 comments

Comments

@Wemaka
Copy link

Wemaka commented Mar 17, 2023

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 %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant