Laravel 4 + Zurb Foundation 5的最佳实践? [英] Best practice for Laravel 4 + Zurb Foundation 5?

查看:80
本文介绍了Laravel 4 + Zurb Foundation 5的最佳实践?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TL; DR::将Laravel 4 + Zurb Foundation 5组合(与Compass一起)配置为一个具有干净公共资源(静态)的一致存储库的最佳方式是布置文件,程序包管理器和构建工具部分?

TL;DR: what is the best way to arrange files, package managers and build tools for Laravel 4 + Zurb Foundation 5 combo (with Compass) as one consistent repository with clean public (static) section?

我想基于后端的最新Laravel并使用Foundation作为前端来启动一个新项目.我对这两个都是新手,显然我错过了一段时间不使用PHP时同时开发的一些工具.

I wanted to start a fresh project, based on latest Laravel on the backend side and using Foundation for the frontend. I am new to both of these and apparently I missed some of the tooling that was developed meanwhile when I wasn't doing PHP for some time.

我的困惑:

  • Laravel使用Composer进行安装和依赖项/模块管理. (好,我是Composer的新手)
  • 基金会可以作为Composer模块使用(但是那又怎样?),通常也可以作为CLI工具来创建新项目,并使用Bower进行模块/依赖关系管理.但是然后我有两个存储库.
  • 是否需要公开所有.scss文件,或者甚至将整个Foundation项目放入laravel的公共目录中才能使所有工作正常?

人们通常如何一起使用这些框架?他们不应该干涉,但是他们仍然拥有完全不同的工具.

How do people usually approach using these frameworks together? They shouldn't interfere, but they still have totally different tooling.

我的基础文件放在哪里?保留它作为作曲家模块还是放在public内部?如何称呼他们?如何拥有一个build everything命令?

Where do I put my foundation files? Keep it as composer module or inside public? How to refer to them? How to have one build everything command?

推荐答案

我遇到的问题与将Bootstrap SCSS版本用于Admin&前端的SCSS基础.我还注意到,两个css框架都作为composer软件包提供,但是这种方法的问题是,您通常在开发中使用其他Javascript文件,这些文件也将被合并,因此使用composer版本只会增加混乱.

I have the same issue as using Bootstrap SCSS version for Admin & Foundation SCSS for the frontend. I noticed also that both css frameworks come as composer packages however the issue you have with this approach is that you generally use other Javascript files in a development that will be merged also so using the composer versions just adds to the confusion.

我发现最好的解决方案是在Laravel版本的顶层使用口香糖或咕unt咕bow的声音.而是为您完成配置,在 http:上有一篇不错的文章: //blog.elenakolevska.com/using-grunt-with-laravel-and-bootstrap/可以进行引导集成,但是可以对Foundation进行调整.此解决方案很好,因为grunt还有许多其他流行的javascript库,您也可以在项目中使用它们..

The best solution i found was using either gulp or grunt with bower at the top level of your Laravel build. Rather that go through the configuration for you there is a good article at http://blog.elenakolevska.com/using-grunt-with-laravel-and-bootstrap/ that goes over a bootstrap integration but this can be tweaked for Foundation. This solution is good as grunt has many of the other popular javascript libraries that you may use in your project also..

或者,您可以使用诸如codekit之类的应用程序,并创建一个罗盘项目来管理合并和将您的资产编译到公用文件夹中.附带说明一下,如果再次使用git,则需要从项目中排除其他文件夹.

Alternatively you could use an application like codekit and create a compass project to manage the merging & compiling of your assets into the public folder. As a side note if using git again your would need to exclude additional folders from your project.

如果您将SCSS框架文件视为开发资产,则实际上并不需要将它们包含在项目中,因为您实际上只需要开发计算机上的一个Foundation版本.

If you think of your SCSS framework files as development assets there is no real need for them to be in the project as you only really need one version of Foundation on your development machine.

您的自定义SCSS更改可以作为模块(即导航模块)通过项目的私人作曲者仓库添加到Laravel项目中,或者在开发时添加到Compass项目中.您的公用文件夹应仅引用最终合并的样式.css&例如java.js文件.然后,可以将框架中的所有图像都复制到公共文件夹中,例如图标等.希望对您有所帮助.

Your custom SCSS changes can be added to your Laravel project as modules ie a navigation module, via a private composer repo for the project or just added to the Compass project at development time. Your public folder should only be referencing the final merged style.css & java.js files for example. Any images from the framework can then just be copied over to the public folder ie icons etc.. Hope that helps..

这篇关于Laravel 4 + Zurb Foundation 5的最佳实践?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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