角JS + Laravel 4:如何编译生产模式? [英] Angular JS + Laravel 4: How to compile for production mode?

查看:173
本文介绍了角JS + Laravel 4:如何编译生产模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有看过大卫·毛思迪大约角JS(顺便说一下西元大)的5个部分的YouTube视频。在第2部分( http://www.youtube.com/watch?v=hqAyiqUs93c),它有一个实用的mysql数据库的使用,我差点就想。

So i have watched the 5 part youtube videos by David Mosher about Angular JS (vids great by the way). In the part 2 (http://www.youtube.com/watch?v=hqAyiqUs93c), it has a practical mysql database usage which I almost wanted.

我要与Laravel 4,一起使用AngularJS,但我不知道哪些文件,我将上传网络后托管即可。我试图在本地主机上运行的/公用文件夹中的Web应用程序在我的根(本地主机/公/),但CSS和JS指向错误的目录(指向根:/css/style.css )。

I'm going to use AngularJS along with Laravel 4, but I had no idea which files I'm going to upload for the web hosting later. I'm trying to run the web app under "/public" folder in my root on localhost (localhost/public/) but the css and js points to the wrong directory (points to the root: '/css/style.css').

我曾尝试另一种方法是通过复制所有文件到根和移动的所有文件里面的公为root。然后,我定位到本地主机/公/。所有的工作在脚本路径问题,只是它不似乎做数据库的任何连接(无论是laravel或角失败)。

Another method I have tried is by copying all the files to the root and moved all files inside "public" to root. Then I navigate to "localhost/public/". All works fine in script paths, except that it doesn't seemed to do any connection to the database (either the laravel or angular failed).

有没有做到这一点,对实际使用(不使用 PHP工匠服务咕噜运行或任何适当的方式前锋运行在服务器上的 )?哪些文件,我应该后上传?

Is there any proper way to do this for practical use (without using php artisan serve or grunt run or lineman run on the server)? Which files I should upload later?

编辑:原因是我的虚拟主机不允许我安装nginx的或运行code远程使用腻子,所以我需要一个手动的方式来做到这一点。谢谢你。

the reason is my web hosting doesn't allow me to install nginx or run code remotely using putty, so I need a manual way to do this. Thanks.

推荐答案


  • 首先安装最新的 laravel 在你的本地主机。请参见 DOC

  • 假设你已经完成了作曲安装命令。

  • 然后将你的所有公共文件夹的内容,以项目的根。

  • 下一步修改 21行的index.php

  • First install latest laravel in your localhost. See doc.
  • Assuming you have completed composer install command.
  • Then move your all public folder contents to the project root.
  • Next change the line 21 in index.php from,

    require __DIR__.'/../bootstrap/autoload.php'; 
    

    require __DIR__.'/bootstrap/autoload.php'; 
    

    35行内容

    $app = require_once __DIR__.'/../bootstrap/start.php';
    

    $app = require_once __DIR__.'/bootstrap/start.php';
    

    现在你可以不用公用文件夹访问项目。

    Now you can access project without public folder.

    要做到这一点打开供应商/ laravel /框架/ src目录/照亮/浏览/编译器/ BladeCompiler.php 文件,修改行45 这个

    To do this open vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php file and change line 45 to this

    protected $contentTags = array('{=', '=}');
    

    52行这个

    protected $escapedTags = array('{={', '}=}');
    

    现在你可以使用 {{的角度和 {= 刀片。

    Now you can use {{ for angular and {= for blade.

    现在在刀片中使用这些,

    Now use these in blade,

     {= HTML::style('css/style.css') =} // links localhost/project/css/style.css
    
     {= HTML::script('js/jquery.js') =}
    


  • 使用迁移分贝种子以dB为单位的本地主机,使导出的副本在线托管

  • Use migrations and db seeds in localhost and make an exported copy of db for online hosting

    在完成项目后,复制整个项目内容的在线服务器和数据库的变化配置和导入数据库。

    After completing project, copy entire project content to online server and change db configuration and import database.

    目录结构网上

    将有一个公共目录为你的档案托管,在那里你把你的文件放在Web根目录。

    There will be a public directory for your file hosting, where you put your files in web root.

    这可能是的htdocs 的public_html ,现在是你的项目的公共root.Now的目录结构将是,

    That may be htdocs or public_html and now it's your project public root.Now the directory structure will be,

    -- app
    
    -- bootstrap
    
    -- css
    
    -- images
    
    -- js
    
    -- vendor
    

    这篇关于角JS + Laravel 4:如何编译生产模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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