Download the PHP package wendelladriel/laravel-estilo without Composer
On this page you can find all versions of the php package wendelladriel/laravel-estilo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wendelladriel/laravel-estilo
More information about wendelladriel/laravel-estilo
Files in wendelladriel/laravel-estilo
Package laravel-estilo
Short Description Manage your CSS in PHP and easily use it on Blade
License MIT
Informations about the package laravel-estilo
Estilo for Laravel
Manage your CSS in PHP and easily use it on Blade[!WARNING] This package is not stable yet, and breaking changes can be added even in minor versions before it reaches v1.0.0.
Check the Changelog for breaking changes, features and bug fixes.
Features
- Create CSS styles in PHP in a fluent way.
- Easily add the CSS styles you want in Blade files with the
@estilodirective. - Group styles together with tags and include only the needed ones with
@estilo(['tag_1', 'tag_2']). - The package provides hints for hundreds of CSS properties via the
@methodannotation to help you write your styles. - TailwindCSS support for creating your own "classes" by grouping TailwindCSS classes.
Installation
Config
Publish the config file:
The config file will be added to config/estilo.php.
It might feel quite unusual from the common config files you see.
Styles
Estilo lets you define your CSS in PHP, using a fluent builder with autocompletion for hundreds of CSS properties.
Defining a Style
To define a new style you should use the Estilo::define() method inside the config/estilo.php file.
Each time you call Estilo::define() you create a style definition. You can use any CSS selector that you would:
classes, tags, ids, etc.
If you need the value to be wrapped in quotes, add double quotes when defining.
Checking if a Style exists
To check if a style is already defined you can use the Estilo::has() method.
Deleting a Style
To delete a style, you can use the Estilo::forget() method.
Tagging Styles
You can pass a 3rd parameter to the Estilo::define() method that's an array of tags. This is especially powerful to
create different stylesheets for your application.
Using the Styles in Blade
When you need to use any of the styles generated with Estilo in your Blade files, you can use the @estilo
directive, by adding it to the <head> tag of your page. This will load ALL the styles created with Estilo to your
Blade file.
When you add the @estilo directive, it will create a <style> tag with all the styles that are needed.
For example, this:
Will generate this:
Adding only specific Styles
You can use the tags feature to load only specific styles that you want. The example below will load only the styles
tagged with the tags common and typograph.
Using Styles as inline style
You may need or want to use some of the defined styles as inline styles. For that you can use the estilo() helper
function. With this you can use any of defined classes, even the ones not loaded with the @estilo directive.
TailwindCSS support
Estilo lets you create "classes" that are groups of other TailwindCSS classes, similar to what you achieve with the
@apply. This won't create a CSS class, but will allow you to use it in your Blade files as if it were.
Defining a Style
To define a new style you should use the EstiloWind::define() method inside the config/estilo.php file. Each time
you call EstiloWind::define() you create a style definition.
Checking if a Style exists
To check if a style is already defined you can use the EstiloWind::has() method.
Deleting a Style
To delete a style, you can use the EstiloWind::forget() method.
Using the Styles in Blade
To use your defined "classes" you can use the estilowind() helper function in your HTML class attribute.
Credits
- Wendell Adriel
- All Contributors
Contributing
Check the Contributing Guide.