0

我正在开发一个 ASP.NET MVC 项目。我在视觉工作室设计了我的网页。起初,我只是将我的 HTML 代码复制到 .cshtml 文档中,然后将 .css 文件移动到适当的位置(在 wwwroot 中)。

当我这样做时,在 .css 文件的末尾,有以下链接:

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/styles.min.css?h=a9f290cd0cc57883e137369b4ae648cc"> 

我当时并不担心.css文件扩展后的字符。样式表没有问题。

再次导出后,最后我得到了新的数字:

<link rel="stylesheet" href="~/lib/bootstrap/dist/css/styles.min.css?h=cd91b4591da6e3a842e0881e1a97d069">

我认为这没有问题,我可以替换文件。我替换了文件,并替换了链接。结果,与这些样式表关联的所有 html 页面都停止使用该样式表。我检查了网络,看起来我的浏览器确实合法地链接了样式表。

我恢复到原始链接,唯一缺少的样式是我添加的新样式。似乎它正在引用一个较旧的样式表(我看不到)。

4

1 回答 1

0

Update:

As I expected, the numbers at the end were version numbers.

Workaround: when you export from Bootstrap Studio, there is a check box that determines whether or not to version the assets exported. It was previously checked. I simply unchecked it, and replaced the files and the corresponding links (to links that did not contain version numbers). Everything worked great.

I believe that the issue began in the bootstrap.css file with this line of code:

sourceMappingURL=bootstrap.css.map

I also believe that the solution to this problem would be to replace the bootstrap.css.map file (which I apparently forgot to do) so that the version mapping will be updated.

If versioning is not desired, then one can do as I did, or they can comment out the line of code like this.

于 2019-08-18T22:37:12.033 回答