简体   繁体   English

引导程序4 sass的软件包?

[英]Package for bootstrap 4 sass?

I used to deploy Bootstrap.SASS (bootstrap 4 with SASS),in my standard .net web forms app with Nuget package manager. 我曾经在带有Nuget软件包管理器的标准.net Web表单应用程序中部署Bootstrap.SASS(带有SASS的Bootstrap 4)。 If try that with a .net core web app in visual studio nothing gets added to the fie system or my project (nothing in content directory. No sass or scss files.) 如果在Visual Studio中使用.net核心Web应用程序进行尝试,则不会将任何内容添加到fie系统或我的项目中(内容目录中没有内容。sass或scss文件中没有。)

LibMan does not seem to have any bootstrap 4 package that contains the SASS content. LibMan似乎没有任何包含SASS内容的bootstrap 4软件包。 How do I best integration Bootstrap SASS in my projects with Visual Studio 2019? 如何在我的项目中将Bootstrap SASS与Visual Studio 2019最佳集成?

Considering no one else has attempted an answer, I'll make one up, but keep in mind I'm not a frontend web developer. 考虑到没有其他人尝试过答案,我会做一个弥补,但是请记住,我不是前端Web开发人员。

NuGet packages with content files do not support projects using PackageReference. 带有content文件的NuGet软件包不支持使用PackageReference的项目。 SDK style projects only support PackageReference, never packages.config, and .NET Core projects only build with SDK style projects. SDK样式项目仅支持PackageReference,不支持package.config,而.NET Core项目仅使用SDK样式项目构建。 Hence content files don't work with .NET Core projects, including ASP.NET Core. 因此, content文件不适用于.NET Core项目,包括ASP.NET Core。 NuGet introduced a new contentFiles folder for PackageReference, but it works differently to content , and I imagine it doesn't work the way you'll need it to for compiling SASS to CSS. NuGet为PackageReference引入了一个新的contentFiles文件夹,但它与content工作方式不同,我想它无法像将SASS编译为CSS那样使用。

Given that browsers don't support SASS directly, it means you must have something compiling/transpiling the scss files into css, and that's probably a tool installed via npm. 鉴于浏览器不直接支持SASS,这意味着您必须将scss文件编译/编译为css,并且可能是通过npm安装的工具。 Given that Bootstrap is distributed via npm, it seems that it would be low cost for you to get bootstrap sass via npm as well. 假设Bootstrap是通过npm分发的,那么通过npm获得bootstrap sass的成本似乎也很低。 Bootstrap's download web page says Bootstrap的下载网页

Bootstrap's package.json contains some additional metadata under the following keys: Bootstrap的package.json在以下键下包含一些其他元数据:

  • sass - path to Bootstrap's main Sass source file sass-Bootstrap的主要Sass源文件的路径
  • style - path to Bootstrap's non-minified CSS that's been precompiled using the default settings (no customization) 样式-使用默认设置(未经自定义)预编译的Bootstrap非缩小CSS的路径

which is frankly meaningless to me, but at a guess maybe you should install "bootstrap@sass", or something similar. 坦白说,这对我来说毫无意义,但也许您应该安装“ bootstrap @ sass”或类似的东西。 I'm sure you can figure it out quickly with a few web searches. 我相信您可以通过一些网络搜索快速找到答案。 Having said that, there are also "bootstrap-sass" and "bootstrap-scss" npm packages, so perhaps you could use one of them. 话虽如此,还有“ bootstrap-sass”和“ bootstrap-scss” npm软件包,因此也许您可以使用其中之一。

I discovered that I could use LibMan with the unpkg provider. 我发现可以在unpkg提供程序中使用LibMan。 The bootstrap package on unpkg has sass. unpkg上的bootstrap软件包具有sass。

The trick was that I couldn't get LibMan with unpkg to work if I used the GUI Tool accessed under Project Node (Right click) -> Add -> Client Side Library. 诀窍是,如果我使用在项目节点(右键单击)->添加->客户端库下访问的GUI工具,则无法使用unpkg的LibMan正常工作。 Instead I had to edit the LibMan.json file and add the package manually, then it would install. 相反,我必须编辑LibMan.json文件并手动添加软件包,然后才能安装。

//https://docs.microsoft.com/en-us/aspnet/core/client-side/libman/?view=aspnetcore-2.2
{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    ...
    {
      "provider": "unpkg",
      "library": "bootstrap@4.3.1",
      "destination": "wwwroot/lib/bootstrap/"
    },
    ...
  ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM