簡體   English   中英

Sapper:如何從 node_modules 導入 CSS?

[英]Sapper: How to import CSS from node_modules?

我正在嘗試這樣做(在工兵中):

<style global>
@import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css';
</style>

但是在前端獲得404。

還從那里導入 CSS 的模塊中看到 404。

You can easily import CSS directly from your node_modules folder using the webpack and the CSS Loader. This is superior to just copy-and-pasting the CSS code because it ensures that the CSS style you are using for your website will always be in sync with your version of the library

By Using (~) you can import the CSS from the Node Modules:-

@import "~package/css-stylesheet";

div {
  background-image: url("~package/image.jpeg");
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM