Download the PHP package popphp/pop-css without Composer
On this page you can find all versions of the php package popphp/pop-css. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download popphp/pop-css
More information about popphp/pop-css
Files in popphp/pop-css
Package pop-css
Short Description Pop CSS Component for Pop PHP Framework
License BSD-3-Clause
Homepage https://github.com/popphp/pop-css
Informations about the package pop-css
pop-css
- Overview
- Install
- Quickstart
- Selectors
- Media Queries
- Comments
- Parse CSS
- Minify
Overview
pop-css
provides the ability to create new CSS files as well as parse existing ones.
There is support for a number of CSS-based features such as media queries, comments
and even minification.
pop-css
is a component of the Pop PHP Framework.
Top
Install
Install pop-css
using Composer.
composer require popphp/pop-css
Or, require it in your composer.json file
"require": {
"popphp/pop-css" : "^2.0.1"
}
Top
Quickstart
In creating CSS, you will use the main CSS object and create and add selector, media and comment objects to it to build your CSS.
The above code will produce:
Rendering the CSS can happen a number of ways:
Call the render method
Call a string function
Write to file
The main CSS object's constructor is also flexible and other CSS-related objects can be injected into it:
Top
Selectors
The selector object is the main object in which to define the various selectors and add them to the main CSS object. The selector constructor accepts any valid CSS selector.
The above code will produce:
Top
Media Queries
Media queries can be created as separate objects that contain their own selector objects. They are then added to the main CSS object.
The above code will produce:
Top
Comments
Comments can be added in a number of places. They can be added to the top of the main CSS content, to the top of a selector or to the top of a media query.
The above code will produce:
Comments can be tailored with the $wrap
and $trailingNewLine
properties that can be passed into
the comment constructor. If the $wrap
is set to 0
, it will force a single-line comment.
The above code will produce:
Top
Parse CSS
You can parse CSS with the following methods:
In each case, it will return a CSS object populated with the related CSS objects from the content of the source.
Top
Minify
Setting the minify property on the main CSS object will perform a basic minification of the CSS content.
The above code will produce:
Top