gpt4 book ai didi

twitter-bootstrap-3 - Bootstrap "grunt watch"不会创建 bootstrap.min.css

转载 作者:行者123 更新时间:2023-12-04 08:03:55 30 4
gpt4 key购买 nike

我几乎完全不熟悉咕噜声。
我在 bootstrap 3.1.1 和 grunt watch 中使用了 grunt -命令效果很好。我的 bootstrap.min.css 文件每次都被编译。 (我上传了我的 bootstrap.min.css)

后来我丢失了我的 3.1.1 grunt 文件(长话短说我的电脑崩溃了)。
所以现在使用 Bootstrap 3.2.0 我要重新建立我的 grunt-work-flow。

但是现在当我使用 grunt watch我只编译了“bootstrap.css”和“bootstrap.theme.css”。

我花了最后几个小时来解决这个问题,但没有成功。

我要什么
我要 grunt watch编译缩小的“bootstrap.min.css”
那么我如何在 watch 上调用 min.css 函数?

我会很高兴得到一些帮助。

最佳答案

Grunt watch 只会监视文件然后运行你设置的任务。我假设在你的 gruntfile 中你有这样的东西:

css: {
files: [
'bootstrap.css',
],
tasks: ['less'],
},

在较少的任务中,您应该有如下内容。请注意 cleancss选项设置为真:
options: {
cleancss: true
},

files: {
"dest/bootstrap.min.css": "src/bootstrap.css",
"dest/bootstrap.theme.min.css": "src/bootstrap.theme.css"
}

更新:

根据您上传的文件,您应该运行 cssmin:core当 watch 被触发时的任务。

更新 2:
要更新监视任务,您只需将 cssmin:core 任务添加到 less 子任务:
less: {
files: 'less/**/*.less',
tasks: ['less', 'cssmin:core]
}

在这里,您告诉它运行 less 任务,然后是 cssmin在观看时更改较少文件之一时的任务。

关于twitter-bootstrap-3 - Bootstrap "grunt watch"不会创建 bootstrap.min.css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25189749/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com