【问题标题】:Inject dependencies into grunt serve index file将依赖项注入 grunt serve 索引文件
【发布时间】:2014-03-29 20:22:58
【问题描述】:

所以我使用 bower 来打包我的包裹,而 grunt serve 是我使用 grunt 所使用的,我想知道的是,只是为了节省我的时间。

如何让 grunt/bower 从命令行(最适合工作流)或使用初始 index.html 文件中的 .json 文件包含我需要的内容?

所以在这种情况下我已经跑了,

yo webapp(or mobile)
bower install topcoat --save
bower install jplayer --save
bower update
grunt serve

这是我的 json 文件

{
  "name": "imtoolbox",
  "version": "0.0.0",
  "dependencies": {
    "topcoat": "~0.8.0",
    "requirejs": "~2.1.4",
    "modernizr": "~2.6.2",
    "jquery": "~1.9.1",
    "jplayer": "~2.5.5"
  },
  "devDependencies": {}
}

我的头

<link rel="stylesheet" href="styles/main.css">
        <!-- build:js scripts/vendor/modernizr.js -->
        <script src="bower_components/modernizr/modernizr.js"></script>
        <!-- endbuild -->

        <!-- build:css styles/vendor/topcoat/css/topcoat-mobile-light.min.css -->
        <link rel="stylesheet" href="styles/vendor/topcoat/css/topcoat-mobile-light.min.css">
        <!-- endbuild -->

我的脚本

<!-- build:js scripts/main.js -->
        <script data-main="scripts/main" src="bower_components/requirejs/require.js"></script>
        <!-- endbuild -->

        <!-- build:js scripts/async-local-storage.js -->
        <script src="scripts/async.localStorage.js"></script>
        <script src="scripts/async.localStorage.examples.js"></script>
        <!-- endbuild -->

        <!-- build:js scripts/fullscreensnippet.js -->
        <script src="scripts/fullscreensnippet.js"></script>
        <!-- endbuild -->

        <!-- build:js scripts/fastclick.js -->
        <script src="scripts/fastclick.js"></script>
        <script src="scripts/fastclick.example.js"></script>
        <!-- endbuild -->

在这方面的任何帮助都会很棒,它会在网上找到很多不同的答案,并且有一些有用的东西会很甜蜜!

【问题讨论】:

标签: gruntjs yeoman bower


【解决方案1】:

我认为你缺少鲍尔的接线

<!-- build:js scripts/myscripts.js -->
<!-- bower:js -->
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/sass-bootstrap/dist/js/bootstrap.js"></script>
<!-- endbower -->
<!-- endbuild -->

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-19
    • 2013-06-23
    • 1970-01-01
    • 2011-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多