Frontend - SASS / SCSS 文件使用

目录

一、安装所需依赖

[1. django-compressor](#1. django-compressor)

[2. django-sass-processor](#2. django-sass-processor)

[二、settings.py 文件配置](#二、settings.py 文件配置)

三、html使用

[1. 配置](#1. 配置)

[2. 导入](#2. 导入)


一、安装所需依赖

1. django-compressor

2. django-sass-processor

安装依赖,可参考另一篇文章:Backend - 安装依赖(pip 、tar.gz)_python通过tar.gz包安装依赖包-CSDN博客

二、settings.py 文件配置

python 复制代码
# settings.py
INSTALLED_APPS = [
      ...
    'sass_processor',
]
STATICFILES_FINDERS = [
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'sass_processor.finders.CssFinder',
]
SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR, "luoboPro/static/")
# 或者 SASS_PROCESSOR_ROOT = os.path.join(BASE_DIR,'static','css')

三、html使用

1. 配置

html 复制代码
 {% load sass_tags %}

2. 导入

html 复制代码
<link rel="stylesheet nofollow" type="text/css"  href="{% sass_src 'scss/xxx/xxx.scss' %}">
相关推荐
qianmoQ6 分钟前
第五章:工程化实践 - 第三节 - Tailwind CSS 大型项目最佳实践
前端·css
椰果uu21 分钟前
前端八股万文总结——JS+ES6
前端·javascript·es6
微wx笑42 分钟前
chrome扩展程序如何实现国际化
前端·chrome
~废弃回忆 �༄1 小时前
CSS中伪类选择器
前端·javascript·css·css中伪类选择器
CUIYD_19891 小时前
Chrome 浏览器(版本号49之后)‌解决跨域问题
前端·chrome
IT、木易1 小时前
跟着AI学vue第五章
前端·javascript·vue.js
薛定谔的猫-菜鸟程序员1 小时前
Vue 2全屏滚动动画实战:结合fullpage-vue与animate.css打造炫酷H5页面
前端·css·vue.js
春天姐姐2 小时前
vue3项目开发总结
前端·vue.js·git
谢尔登2 小时前
【React】React 性能优化
前端·react.js·性能优化
来一碗刘肉面2 小时前
TypeScript - 属性修饰符
前端·javascript·typescript