Laravel Elixir wrong paths -


this gulpfile.js

var elixir = require('laravel-elixir');  elixir(function(mix) {     mix.less([        'style.less'     ], 'public/css/style.css')         .styles([        'reset.css',        'font-awesome.min.css',        'style.css'     ], 'public/css/app.css', 'public/css')     .scripts(['jquery-1.12.0.min.js', 'main.js'], 'public/js/app.js', 'resources/assets/scripts')     .version(['css/app.css', 'js/app.js']);  }); 

as result files

public/build/app-2a14246111.css
public/build/app-7790e07dfb.js
public/build/rev-manifest.json

but when try add css , js files layout

<link rel="stylesheet" href="{{ elixir("css/app.css") }}">     <script src="{{ elixir("js/app.js") }}"></script>  

i

<link rel="stylesheet" href="/build/css/app-2a14246111.css"> <script src="/build/js/app-7790e07dfb.js"></script> 

and browser can't find them because tries find

http://localhost:8080/build/css/app-2a14246111.css http://localhost:8080/build/js/app-7790e07dfb.js 

and project folder name , public folder missed somehow in paths. how fix it?

actually see, can add dot in paths like

<link rel="stylesheet" href=".{{ elixir("css/app.css") }}"> <script src=".{{ elixir("js/app.js") }}"></script> 

and work, don't kind of fix.

that's because you're running laravel project on localhost. when deploy project server, problem resolves (assuming it's configured correctly).

if you're using apache, can add virtual host configuration instead of http://localhost:8080/laravel/public can use http://domain-name.app:

<virtualhost *:80>        documentroot "c:\users\username\path\to\laravel\public"      servername domain-name.app </virtualhost> 

and in hosts file add:

127.0.0.1   domain-name.app 

this way, can link absolute paths in html /css/somefile.css instead of ./css/somefile.css.

checkout homestead, laravel, helps avoid lot of pain in ass.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -