2

我的项目中有两个 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

任何帮助将不胜感激。

4

1 回答 1

3

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

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

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

于 2020-01-30T18:53:23.377 回答