通过 Composer 下载后如何设置 Bootstrap? [英] How do I set up Bootstrap after downloading via Composer?

查看:32
本文介绍了通过 Composer 下载后如何设置 Bootstrap?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Composer 的初学者,所以我对它知之甚少,对 Web 应用程序开发的经验也很少.

I'm a beginner with Composer, so I know little about it and have little experience with web application development.

我正在阅读 Nettuts+ 教程,并有一个关于 Composer 的基本问题.

I was reading the Nettuts+ Tutorial, and have a basic question about Composer.

{
  "require": {
    "laravel/framework": "4.0.*",
    "way/generators": "dev-master",
    "twitter/bootstrap": "dev-master",
    "conarwelsh/mustache-l4": "dev-master"
  },
  "require-dev": {
    "phpunit/phpunit": "3.7.*",
    "mockery/mockery": "0.7.*"
  },
  "autoload": {
    "classmap": [
      "app/commands",
      "app/controllers",
      "app/models",
      "app/database/migrations",
      "app/database/seeds",
      "app/tests/TestCase.php"
    ]
  },
  "scripts": {
    "post-update-cmd": "php artisan optimize"
  },
  "minimum-stability": "dev"
}

如果我像上面那样设置我的 composer.json 文件,在执行 composer install --dev 之后,我如何让 Bootstrap 可以在 Laravel 项目中使用?

If I set up my composer.json file as above, after executing composer install --dev, how do I make Bootstrap available for use in the Laravel project?

我的意思是,我可以看到 Bootstrap 包已下载到供应商目录.之前我只习惯从其官网下载Bootstrap并手动将文件放在Laravel的公共目录中,但在这里这样做的正确方法是什么?我可以将 Bootstrap 文件保留在原处,因为我想定期将 Bootstrap 包更新到最新版本吗?

I mean, I can see the Bootstrap package is downloaded to the vendor directory. Before I only used to download Bootstrap from its official website and manually put the files in the public directory of Laravel, but what is the right way to do this here? Can I leave the Bootstrap files where they are, because I want to update the Bootstrap package to its latest version periodically?

谢谢.

推荐答案

我们有 artisan 命令来发布资产(CSS、JS、..).像这样的东西应该可以工作.

We have artisan command to publish the assets(CSS, JS,..). Something like this should work.

php artisan asset:publish --path="vendor/twitter/bootstrap/bootstrap/css" bootstrap/css
php artisan asset:publish --path="vendor/twitter/bootstrap/bootstrap/js" bootstrap/js

我不确定路径..但​​这应该可行.

i am not sure about the path.. But this should work.

这篇关于通过 Composer 下载后如何设置 Bootstrap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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