0

I have in laravel/app/views/css a file style.css and this is not public, how can i use this in template using <style></style>. I don't want this to be a link (<link href="style.css" rel="stylesheet">), just plain text inside html.

i kwon how to do this with blade:

<link href="style.css" rel="stylesheet">

but i want to learn how to do something like this from file:

<style>
//css code
</style>

with TWIG i know i can do this: <style> {{ include(//link to css file) }} </style>

The only way i know i can do this with blade is:

rename the login.css to login.blade.php

<style type="text/css" media="screen">
    @include('css.login')
</style>

have another way?

3 Answers 3

1

Your approach is pretty fine, and I would prefer your approach, but if you want to alter you can use something like this, too:

<style> <?php include_once('./app/views/css/style.css'); ?></style>
Sign up to request clarification or add additional context in comments.

Comments

0

You don't need another way, this is perfectly fine.

Comments

0

As Meroje and Arda said those are the out-of-box ways to handle it. You could add new Blade Extension for handling that use case, so then you could say for example @include_css('style.css') and that's it. You could even output the <style>...</style> surrounding the style =)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.