简体   繁体   English

如何用grunt构建主干样板?

[英]How do I build backbone boilerplate with grunt?

I'm trying to build the backbone boilerplate project found here: https://github.com/backbone-boilerplate/backbone-boilerplate 我正在尝试构建在这里找到的骨干样板项目: https : //github.com/backbone-boilerplate/backbone-boilerplate

I'm having some issues getting it to build properly. 我在使其正确构建时遇到一些问题。 Here are the steps I've done which are the steps on the backbone-boilerplate wiki: 这是我已完成的步骤,这些步骤是骨干模板Wiki上的步骤:

git clone https://github.com/backbone-boilerplate/backbone-boilerplate.git
cd backbone-boilerplate
sudo npm install -gq bower
sudo npm install -q
sudo npm install -gq grunt-cli
sudo grunt

At this point I get: 至此,我得到:

>> Local Npm module "grunt-cli" not found. Is it installed?
Warning: Task "requirejs" not found. Use --force to continue.

Aborted due to warnings.

Any ideas how to get this to build properly? 任何想法如何使它正确构建?

Specifying depth seems to work: 指定深度似乎有效:

$ git clone --depth 1 https://github.com/backbone-boilerplate/backbone-boilerplate.git
$ npm install
$ grunt

Also you may want to restart your terminal if that is your first time installing grunt-cli 另外,如果这是您第一次安装grunt-cli ,则可能要重新启动终端

You're running grunt under elevated privileges. 您正在特权下运行grunt Our documentation for building here: 我们在此处构建的文档:

https://github.com/backbone-boilerplate/backbone-boilerplate#build-process https://github.com/backbone-boilerplate/backbone-boilerplate#build-process

... has you run that command under your own user. ...您是否已在自己的用户下运行该命令。 Give that a shot! 试一试!

You need to ensure you build dependencies with bower, not just the node dependencies. 您需要确保使用Bower构建依赖关系,而不仅仅是节点依赖关系。

Getting Started 入门

# Using Git, fetch only the latest commits.  You won't need the full history
# for your project.
git clone --depth 1 https://github.com/backbone-boilerplate/backbone-boilerplate

# Move the repository to your own project name.
mv backbone-boilerplate my-project

Updating Dependencies 更新依赖项

# Install global dependencies.  Depending on your user account you may need to
# gain elevated privileges using something like `sudo`.
npm install -g grunt-cli bower

# Optionally install coveralls (integration is baked in with Travis CI).
npm install -g coveralls

# Install NPM dependencies.
npm install

# Install Bower dependencies. ** THIS IS THE ONE YOU'VE MISSED **
bower install

Build Process 建立过程

# To run the build process, run the default Grunt task.
grunt

# Run a build and test the now optimized assets.
grunt default server:release

If you have node installed correctly this should work like a charm. 如果正确安装了节点,则应该像超级按钮一样工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM