twitter-bootstrap - 使用 Dart 和 Bootstrap

标签 twitter-bootstrap dart project-structure

我正在试验 Dart,现在正在尝试使用 Bootstrap因为它的 CSS 框架。当我下载最新版本的 Bootstrap(目前为 3.0.3)时,它具有以下文件结构:

├── css
│   ├── bootstrap.css
│   ├── bootstrap.min.css
│   ├── bootstrap-theme.css
│   └── bootstrap-theme.min.css
├── fonts
│   ├── glyphicons-halflings-regular.eot
│   ├── glyphicons-halflings-regular.svg
│   ├── glyphicons-halflings-regular.ttf
│   └── glyphicons-halflings-regular.woff
└── js
    ├── bootstrap.js
    └── bootstrap.min.js

(1) 我将所有这些文件放在哪里,以及如何从我的 Dart 源文件和 HTML 文件中访问它们? 例如,假设我想从 Dart 文件中动态更改 DOM,并将 Bootstrap 类添加到元素 - 这会是什么样子?如果我只是想给一个 HTML 元素一个 Bootstrap 类(在一个 .html 文件中),这会是什么样子?

我假设我可能需要一个具有如下包结构的 Dart 项目:
MyDartApp/
    web/
        myapp.dart
    asset/
        bootstrap/
            css/
                bootstrap.css
                bootstrap.min.css
                bootstrap-theme.css
                bootstrap-them.min.css
            fonts/
                glyphicons-halflings-regular.eot
                glyphicons-halflings-regular.svg
                glyphicons-halflings-regular.ttf
                glyphicons-halflings-regular.woff
            js/
                bootstrap.js
                bootstrap.min.js

但是对 Dart 和 Bootstrap 的经验如此之少,不确定我是否遗漏了任何重要的东西。显然,我需要以 asset/ 的方式打包 Bootstrap 文件。我的 Dart/HTML 文件中的 URL 可以在运行之前/之后访问它们 pub build .

(2) 另外,我可以使用min吗? - 每个 CSS/JS 文件的版本(bootstrap.min.js 而不是 bootstrap.js 等)?

最佳答案

  • 您可以使用 asset/文件夹来放置这些文件。但是编辑器中的内置服务器暂时不支持 Assets ,您必须使用 pub serve .要访问它们,请使用 /assets/<pkg_name>/<path> (见 How to refer to assets)。或者,您可以将这些文件放在 /lib/ 下。并通过 packages/<pkg_name>/<path> 访问它们.
  • 您可以使用缩小版本。
  • 关于twitter-bootstrap - 使用 Dart 和 Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20746095/

    相关文章:

    flutter - 如何在使用 ListView.builder 时动态更新特定的 ListView 项?

    dart - 为什么我不能在目录中运行dart文件?

    ruby-on-rails - 我可以在新的 Rails 应用程序中使用通用 namespace 吗?

    javascript - 如何取消setTimeout?

    html - 如何使居中的导航栏响应友好

    dart - dart vm有效,但dart2js失败

    angular - 如何在 AngularDart 中显示表格

    asp.net-mvc-4 - ASP.NET MVC 4 不同项目中的区域

    jquery - 多级下拉菜单 Bootstrap

    javascript - 将 DateTimePicker 传递给值并从值读取的简单方法是什么?