css - WebCompiler 在 CI 构建中跳过 scss 文件

标签 css sass azure-devops continuous-integration web-compiler

我的元素中有两个 scss 文件需要在我的 CI 构建期间(在 Azure Pipelines 上)进行编译。一个是在我本地构建时编译的,一个不是。我正在使用 WebCompiler,日志的输出显示了一个正在运行的文件,但没有显示丢失文件的任何错误。我的 CI 构建由 Devops 套件中的 Azure Pipelines 处理,由于某种原因,CI 构建的工作方式与本地构建不同。

最初,对于未编译的文件,我在 BuildAction 上遗漏了“内容”标识。我已经更正了,但它仍然没有被编译。我已经确认了 compilerconfig.json 文件的内容,两个文件都在那里。

这里是compilerconfig.json

[
  {
    "outputFile": "Content/custom-bootstrap.css",
    "inputFile": "Content/custom-bootstrap.scss"
  },
  {
    "outputFile": "Content/Site.css",
    "inputFile": "Content/Site.scss"
  }
]

这是来自 CI 构建日志文件(源自 Azure Pipelines)的片段。

WebCompile:

  WebCompiler: Begin compiling compilerconfig.json
  WebCompiler installing updated versions of the compilers...
    Compiled Content/custom-bootstrap.css
    Minified Content/custom-bootstrap.min.css
  WebCompiler: Done compiling compilerconfig.json

这是来自本地构建日志的片段。

5>  WebCompiler: Begin compiling compilerconfig.json
5>      Compiled Content/custom-bootstrap.css
5>      Minified Content/custom-bootstrap.min.css
5>      Compiled Content/Site.css
5>      Minified Content/Site.min.css
5>  WebCompiler: Done compiling compilerconfig.json

如有任何帮助,我们将不胜感激。

最佳答案

解决了我自己的问题...

看起来 WebCompiler 在从命令行运行时不会覆盖现有的 css 文件。

我无法让 WebCompiler 在我的 azure 构建上下文中编译此 css,因此我将 css 提交到我的源代码 repo。覆盖在本地构建中发生得很好。离开我的元素几个月后(没有新的开发或部署),我对解决这个问题产生了新的兴趣。事实证明,删除 css 文件现在允许 WebCompiler 为部署包创建 css。不知道为什么我很久以前不尝试这个,但很高兴能解决这个问题。

关于css - WebCompiler 在 CI 构建中跳过 scss 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56972466/

相关文章:

node.js - 来自网络的文件的 node-sass 自定义导入器不起作用

css - 步骤指示器 CSS

tfs - 将本地 TFS 迁移到 Team Foundation Service

html - 使用 background-image 属性的背景图像未出现,因此无法获得所需的显示

javascript - 这种效果应该叫什么?

html - DIV 和 CSS 如何与 Rowspan 和 Colspan 一起工作?

azure - 通过 REST API Powershell 脚本检查 "Allow all pipelines"

javascript - 使用 JQuery 代替 CSS 的幻灯片动画

webpack - 使用 webpack 在没有 js 导入的情况下观看和编译 sass

azure-devops - OpsHub 迁移似乎不再正常运行