Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 275 Vote(s) - 3.54 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using CSS in Laravel views?

#11
For Laravel 5.4 and if you are using mix helper, use

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

#12
Put them in `public` folder and call it in the view with something like `href="{{ asset('public/css/style.css') }}"`. Note that the `public` should be included when you call the assets.
Reply

#13
put your css in public folder, then

add this in you blade file

<link rel="stylesheet" type="text/css" href="{{ asset('mystyle.css') }}">
Reply

#14
To my opinion the best option to route to css & js use the following code:

<link rel="stylesheet" type="text/css" href="{{ URL::to('route/to/css') }}">

So if you have css file called main.css inside of css folder in public folder it should be the following:

<link rel="stylesheet" type="text/css" href="{{ URL::to('css/main.css') }}">
Reply

#15
You can simply put all the files in its specified folder in public like


----------


**public/css <br>
public/js <br>
public/images**


----------


Then just call the files as in normal html like<br>
**`<link href="css/file.css" rel="stylesheet" type="text/css">`**

It works just fine in any version of Laravel
Reply

#16
Use {!! in new laravel


{!! asset('js/app.min.js') !!}

<script type="text/javascript" src="{!! asset('js/app.min.js') !!}"></script>
Reply

#17
For those who need to keep js/css out of public folder for whatever reasons, in modern Laravel you can use [sub-views](

[To see links please register here]

). Say your views structure is

views
view1.blade.php
view1-css.blade.php
view1-js1.blade.php
view1-js2.blade.php

in `view1` add

@include('view1-css')
@include('view1-js1')
@include('view1-js2')

in `views-js.blade.php` files wrap your js code in `<script>` tag

in `views-css.blade.php` wrap your styles in `<style>` tag

That will tell Laravel, and your code editor, that those are in fact `js` and `css` files. You can do the same with additional HTML, SVGs and other stuff that is browser-renderable
Reply

#18
Put your assets in the public folder; e.g.:

public/css
public/images
public/fonts
public/js

And then, to access them using Laravel, use:

{{ HTML::script('js/scrollTo.js'); }}

{{ HTML::style('css/css.css'); }}

Or:

{{ URL::asset('js/scrollTo.js'); }}

{{ URL::asset('css/css.css'); }}

This syntax will automatically generate the correct path (e.g., `public/js/scrollTo.js').
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through