0

I am using laravel 5.2 and I've successfully create all.css in public/css folder using gulp.

but when I try to use all.css in view admin.login using following line of code as defined in laravel 5.2 documentation and it not works

<link rel="stylesheet" type="text/css" href="{{ elixir('css/all.css') }}">

and when I use this following line of code it works.

<link rel="stylesheet" type="text/css" href="{{ url('/public/' . elixir('css/all.css')) }}">

Is it correct? or I am missing some thing?

KazikM
  • 1,257
  • 5
  • 21
  • 29
Shoaib Rehan
  • 526
  • 6
  • 16

1 Answers1

4

If you simple put all.css file into public/css location and you want to simply display this file, you can use:

<link rel="stylesheet" href="{{ asset("css/all.css") }}>

However if you plan to modify this file and you don't want to have caching issues, you can put this all.css file again into

public/css then write below code into gulpfile.js

var elixir = require('laravel-elixir');

elixir(function(mix) {
    mix.version("public/css/all.css");
});

now you need to run gulp in your console

gulp

Now you can use:

<link rel="stylesheet" href="{{ elixir("css/all.css") }}>

This original link will explain better :)

Community
  • 1
  • 1
Ravi Hirani
  • 6,511
  • 1
  • 27
  • 42