在 django 管道中覆盖 Bootstrap
Overriding Bootstrap in django-pipeline
我有一个 Django 应用程序,我正在使用 django-pipeline 包和 bootstrap.css:
PIPELINE_CSS = {
'myCSS': {
'source_filenames': (
'css/bootstrap.css',
'css/bootstrapoverride.css',
),
'output_filename': 'bootmin.css',
'variant': 'datauri',
},
}
正如您在上面看到的,我已经包含了一个附加文件 "bootstrapoverride.css",我希望用它来覆盖 Bootstrap 的某些功能,例如在我的覆盖文件中:
.navbar {
min-height: 100px;
}
所以我认为这可能行得通,但没有发生覆盖,也许这无法使用管道。我想避免直接编辑 bootstrap.css 文件。感谢您在这里提供任何见解。
你可以这样做,但我会以不同的方式设置你的项目。我会有一个 vendor
捆绑包和一个单独的 company
或 project
特定捆绑包。
一个例子看起来像这样;
PIPELINE_CSS = {
'vendor': {
'source_filenames': (
'css/bootstrap.css',
),
'output_filename': 'vendor.css',
'variant': 'datauri',
},
'project': {
'source_filenames': (
'css/bootstrapoverride.css',
),
'output_filename': 'project.css',
'variant': 'datauri',
},
}
然后将它们按此顺序包含在您的 base.html
文件中:
{% stylesheet 'vendor' %}
{% stylesheet 'project' %}
我有一个 Django 应用程序,我正在使用 django-pipeline 包和 bootstrap.css:
PIPELINE_CSS = {
'myCSS': {
'source_filenames': (
'css/bootstrap.css',
'css/bootstrapoverride.css',
),
'output_filename': 'bootmin.css',
'variant': 'datauri',
},
}
正如您在上面看到的,我已经包含了一个附加文件 "bootstrapoverride.css",我希望用它来覆盖 Bootstrap 的某些功能,例如在我的覆盖文件中:
.navbar {
min-height: 100px;
}
所以我认为这可能行得通,但没有发生覆盖,也许这无法使用管道。我想避免直接编辑 bootstrap.css 文件。感谢您在这里提供任何见解。
你可以这样做,但我会以不同的方式设置你的项目。我会有一个 vendor
捆绑包和一个单独的 company
或 project
特定捆绑包。
一个例子看起来像这样;
PIPELINE_CSS = {
'vendor': {
'source_filenames': (
'css/bootstrap.css',
),
'output_filename': 'vendor.css',
'variant': 'datauri',
},
'project': {
'source_filenames': (
'css/bootstrapoverride.css',
),
'output_filename': 'project.css',
'variant': 'datauri',
},
}
然后将它们按此顺序包含在您的 base.html
文件中:
{% stylesheet 'vendor' %}
{% stylesheet 'project' %}