【问题标题】:What is the "//= require bootstrap/affix" notation for? Is there any grunt tool that uses it?“//= 需要引导程序/附加”符号是什么?有没有使用它的 grunt 工具?
【发布时间】:2014-05-28 12:17:05
【问题描述】:

最近我从bootstrap-sass 存储库切换到bootstrap-sass-official,发现bootstrap.js 文件中有一些不熟悉的内容,即:

//= require bootstrap/affix
//= require bootstrap/alert
//= require bootstrap/button
//= require bootstrap/carousel
//= require bootstrap/collapse
//= require bootstrap/dropdown
//= require bootstrap/tab
//= require bootstrap/transition
//= require bootstrap/scrollspy
//= require bootstrap/modal
//= require bootstrap/tooltip
//= require bootstrap/popover

我知道这是只包含一个文件 (bootstrap.js),它告诉我们需要(导入)引导目录中的部分内容。但是,这肯定不是原生 Javascript 的一部分,我在 google 上找不到它是什么。

谁能启发我并告诉我哪个软件应该理解这个符号并负责构建/获取部分代码?或者这只是一个简单的评论(如果是……为什么要为此创建一个单独的文件?)?

编辑:我使用 grunt 来构建我的资产。是否有任何使用这种表示法的 grunt 工具,或者我只是忽略它并在我的布局中引用部分?

【问题讨论】:

    标签: javascript twitter-bootstrap sass


    【解决方案1】:

    Loostro,这是 Ruby on Rails 会寻找的东西,以特定顺序编译资产。 //= 表示法让 Sprockets 知道包含这些文件。您可以在此处了解有关 Rails 的这一部分(称为 Asset Pipeline)的更多信息:http://guides.rubyonrails.org/asset_pipeline.html,或者通过 Hartl 的完美介绍指南,在此处:http://ruby.railstutorial.org/chapters/filling-in-the-layout#sec-sass_and_the_asset_pipeline

    【讨论】:

    • 我使用 grunt 来构建我的资产。是否有任何使用这种表示法的 grunt 工具,或者我只是忽略它并在我的布局中引用部分?
    • 我不熟悉 grunt,但我想我可以为您指明正确的方向。 //= 表示法让 Sprockets 知道包含这些文件,看起来 grunt 有时会与 sprockets 一起工作,这里:npmjs.org/package/grunt-sprockets-directives
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-16
    • 2015-05-30
    • 1970-01-01
    • 1970-01-01
    • 2013-06-05
    • 2018-10-20
    相关资源
    最近更新 更多