包括带有pub的库

时间:2018-06-25 19:11:19

标签: dart dart-pub

如何在pubspec.yaml中将前端库(例如引导程序)包含在dart中?我解决了所有依赖关系,但浏览器显示错误

  

拒绝应用“ http://localhost:63342/BattleCity/build/web/html/packages/bootstrap/css/bootstrap.min.css”中的样式,因为它的MIME类型(“ text / html”)不是受支持的样式表MIME类型,并且启用了严格的MIME检查。

我的pubspec.yaml如下:

name: BC
description: An absolute bare-bones web app.
version: 0.0.1
#homepage: https://www.example.com
#author: localroot <email@example.com>

environment:
  sdk: '>=1.20.1 <2.0.0'

#dependencies:
#  path: ^1.4.1

dependencies:
  path: ^1.4.1
  font_awesome: "^4.7.0"
  bootstrap: "^4.0.0"



dev_dependencies:
  browser: ^0.10.0
  dart_to_js_script_rewriter: ^1.0.1

transformers:
- dart_to_js_script_rewriter

# Uncomment the following in sdk 1.24+ to make pub serve
# use dartdevc (webdev.dartlang.org/tools/dartdevc).
#web:
#  compiler:
#    debug: dartdevc

index.html即时消息中包括带有以下标记的引导程序:

<link rel="stylesheet" href="packages/bootstrap/css/bootstrap.min.css">

.packages如下所示:

# Generated by pub on 2018-06-25 21:00:42.860811.
args:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/args-1.4.3/lib/
async:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/async-1.13.3/lib/
barback:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/barback-0.15.2+15/lib/
bootstrap:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/bootstrap-4.0.0/lib/
browser:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/browser-0.10.0+3/lib/
charcode:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/charcode-1.1.1/lib/
collection:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/collection-1.14.6/lib/
csslib:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/csslib-0.14.3/lib/
dart_to_js_script_rewriter:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_to_js_script_rewriter-1.0.3/lib/
font_awesome:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/font_awesome-4.7.0/lib/
html:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/html-0.13.3/lib/
logging:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/logging-0.11.3+1/lib/
path:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/path-1.5.1/lib/
pool:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/pool-1.3.4/lib/
source_span:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/source_span-1.4.0/lib/
stack_trace:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/stack_trace-1.9.2/lib/
utf:file:///C:/Users/localroot/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/utf-0.9.0+3/lib/
BC:lib/

0 个答案:

没有答案