HTML5Boilerplate js结构 [英] HTML5Boilerplate js structure

查看:210
本文介绍了HTML5Boilerplate js结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人可以检查我对HTML5Boilerplate js目录的预期目的的理解。我知道main.js是我希望放置我创作的所有特定于站点的javascript的地方。 Plugins.js是我放置所有jQuery插件的地方。 main.js和plugins.js都将通过构建过程连接和缩小。 Vendor.js拥有javascript库。这个目录将被缩小(除非它已经缩小)但没有连接。

I'm wondering if someone can check my understanding of what the intended purpose of HTML5Boilerplate js directories. I understand that main.js is where I'm expected to place all site specific javascript that I author. Plugins.js is where I would place all jQuery plugins used. Both main.js and plugins.js will be concatenated and minified by the build process. Vendor.js holds javascript libraries. This directory will be minified (unless it is already minified) but not concatenated.

如果这是真的,那么我的问题是什么应该像可爱的滑块哪里有一个模块结构放置?我想我希望它被缩小和连接,所以它不应该进入供应商目录。我不相信我可以将cuteslider的javascript添加到main.js或plugins.js而不会破坏它的模块化结构。我应该创建一个新目录,并将其称为类似应用程序,以保存cuteslider代码,然后修改构建代码以缩小和连接它吗?

If this is true, then my question is where should something like cute slider which has a modular structure be placed? I'm thinking I want it to be minified and concatenated so it shouldn't go in the vendor directory. I don't believe I can add cuteslider's javascript to main.js or plugins.js without destroying it's modular structure. Should I create a new directory, and call it something like apps, to hold cuteslider code and then modify the build code to minified and concatenated it?

这是一个片段cuteslider的代码结构

Here is a snippet of cuteslider's code structure

cute
    cute.2d.module.js
    cute.canvas.module.js
    cute.css3d.module.js
    cute.gallery.plugin.js
    cute.slider.js
    cute.transitions.all.js


推荐答案

首先你必须考虑将cuteslider作为一个插件。

First you have to consider cuteslider as a plugin.

添加所需文件以使插件正常工作( cute.slider.js cute.transitions.all.js respond.min插件.js中的.js

Add the required files to make the plugin working (cute.slider.js, cute.transitions.all.js and respond.min.js) in the plugins.js.

然后添加js以将滑块加载到 main.js as

Then add the js to load the slider into your page in the main.js as

$(document).ready(function() {
        // code here to load cuteslider
});

模块化外观只能在 main.js 文件中设置。

The modular look have to be set only in the main.js file.

这篇关于HTML5Boilerplate js结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆