我在flask env上为vscode设置libsass,pysass和资产模块时遇到了一些问题

时间:2019-02-18 19:37:30

标签: python flask

我想在.css中编译关于.sass文件

我的根目录

hello.py
__init__.py
/static
----/cass
--------style.scss
----/css
--------style.css
----/images
/templates

所以,我的模块进入了env vscode

blinker==1.4
Click==7.0
Flask==1.0.2
Flask-Assets==0.12
Flask-Mail==0.9.1
itsdangerous==1.1.0
Jinja2==2.10
libsass==0.17.0
MarkupSafe==1.1.0
passlib==1.7.1
pyScss==1.3.5
six==1.12.0
unknown==0.0.0
webassets==0.12.1
Werkzeug==0.14.1
WTForms==2.2.1

hello.py

import sqlite3
import os
from werkzeug.wsgi import SharedDataMiddleware
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, logging, send_from_directory
from wtforms import Form, StringField, TextAreaField, PasswordField, validators
from flask_mail import Mail, Message
from passlib.hash import sha256_crypt
from functools import wraps
from sassutils.wsgi import SassMiddleware
import sass
from flask_assets import Environment, Bundle

app = Flask(__name__)
app.config.from_object(__name__)
assets = Environment(app)


scss = Bundle('sass\style.scss',   filters='pyscss',output='css\style.css')
assets.register('scss_all', scss)

if __name__ == '__main__':
app.run(debug=True)

index.html

{% assets "scss_all" %}
<link rel="stylesheet" type="text/scss" href="{{ ASSET_URL }}"/>
{% endassets %}

style.scss

$theme_color: red;
body {
    background-color: $theme_color;
 }  

有没有给我方便的解决方案,所以当我更改style.sass和style.scss时。我的文件style.css是自动更新的。请给我们当前解决该问题的方法。

0 个答案:

没有答案