将依赖项注入grunt服务索引文件

时间:2014-03-29 20:22:58

标签: gruntjs yeoman bower

所以我正在使用bower作为我的包裹和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 -->

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

1 个答案:

答案 0 :(得分: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 -->