2017 © Pedro Pelรกez
 

library lcss2php

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

image

websemantics/lcss2php

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 11 % Grown

The README.md

                                       โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–žโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                   
                                       โ”‚                 โ”‚                                   
                                       โ”‚   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ   โ”‚                                   
                                       โ”‚   โ”‚         โ”‚   โ”‚                                   
        โ”ฌ  โ•ญโ”€โ•ฎโ•ญโ”€โ•ฎโ•ญโ”€โ•ฎ    โ•ญโ”€โ•ฎโ•ญโ”€โ•ฎโ•ญโ”€โ•ฎโ•ญโ”€โ•ฎ   โ”ƒ   โ”‚   โ–‘ โ–‘โ–‘โ–‘ โ”‚   โ”ƒ โ”ฌโ•ญโ”€โ•ฎ    โ•ญโ”€โ•ฎโ”ฌ โ”ฌโ•ญโ”€โ•ฎ    โ•ญโ”€โ•ฎโ”ฌ โ”ฌโ•ญโ”€โ•ฎ 
        โ”‚  โ”œโ”ค โ•ฐโ”€โ•ฎโ•ฐโ”€โ•ฎ    โ•ฐโ”€โ•ฎโ”‚  โ•ฐโ”€โ•ฎโ•ฐโ”€โ•ฎ   โ”ƒ   โ”‚   โ–‘โ–‘โ–‘โ–‘โ–‘ โ”‚   โ”ƒโ”€โ”คโ”œโ”€โ•ฏ    โ”œโ”€โ•ฏโ”œโ”€โ”คโ”œโ”€โ•ฏ    โ”œโ”€โ•ฏโ”œโ”€โ”คโ”œโ”€โ•ฏ    
        โ”ดโ”€โ•ฏโ•ฐโ”€โ•ฏโ•ฐโ”€โ•ฏโ•ฐโ”€โ•ฏ    โ•ฐโ”€โ•ฏโ•ฐโ”€โ•ฏโ•ฐโ”€โ•ฏโ•ฐโ”€โ•ฏ   โ”ƒ   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ   โ”ƒ โ”ดโ”ด      โ”ด  โ”ด โ”ดโ”ด      โ”ด  โ”ด โ”ดโ”ด             
    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค                 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ     
    โ”‚  โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ”‚   โ–ฏ โ–ฏ โ–ฏ โ–ฏ โ–ฏ โ–ฏ   โ”‚  โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ—ฏ   โ”‚   
    โ•ฐโ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”ค                 โ”œโ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”ฌโ”€โ•ฏ     
       โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚  โ”‚      โ•ญโ”€โ”€โ”€โ•ฎ      โ”‚   โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚     โ”‚โ”‚        
    โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”ค      โ”‚โ”€โ”€โ”€โ”‚      โ”œโ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€โ”€โ”คโ”œโ”€โ”€โ”€โ”€
      โ”€โ”ดโ”ด โ”€   โ”ดโ”ด    โ”€โ”ดโ”ด   โ”€ โ”ดโ”ดโ”€   โ”€โ”ดโ”ด  โ”‚      โ”‚   โ”‚      โ”‚   โ”ดโ”ด โ”€  โ”€โ”ดโ”ดโ”€    โ”ดโ”ดโ”€   โ”€โ”ดโ”ด   โ”€ โ”ดโ”ดโ”€       
                                       โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                   

A straightforward library that extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array., (*1)

Install

1- Use Composer to install as follows,, (*2)

composer require websemantics/lcss2php

Getting Started

Pass a list of files (Less, Scss or a mix ) to a newly created instance of Lcss2php class. Get a list of all the variables using the all method., (*3)

$files = ['/usr/etc/variables.less', '/usr/etc/_variables.scss'];

$lcss2php = new Lcss2php($files);

$variables = $lcss2php->all();

By default all variable types are returned, for example, Color, Dimension, etc. You can use the ignore function to filter some types from the final variables list,, (*4)

$variables = (new Lcss2php($files))->ignore(['Color', 'Dimension'])->all();

Notice that, there are two different variable types for each lanaguage (Less, Scss). For a list of all the types, check class Type at lcss2php/src/Node/Type.php., (*5)

Example

Quick run of what to expect; take this Scss example code,, (*6)

$green: #24ce7b !default;
$blue: #38b5e6 !default;
$orange: #f48714 !default;
$red: #f6303e !default;

$brand-success: $green;
$brand-info: $blue;
$brand-warning: $orange;
$brand-danger: $red;

$spacer: 1rem !default;
$spacer-x: $spacer !default;
$spacer-y: $spacer !default;

Will be converted to,, (*7)

[
  "green" => "#24ce7b"
  "blue" => "#38b5e6"
  "orange" => "#f48714"
  "red" => "#f6303e"
  "brand-success" => "#24ce7b"
  "brand-info" => "#38b5e6"
  "brand-warning" => "#f48714"
  "brand-danger" => "#f6303e"
  "spacer" => "1rem"
  "spacer-x" => "1rem"
  "spacer-y" => "1rem"
]

Support

Star :star: this repository if you find this project useful, to show support or simply, for being awesome :), (*8)

Need help or have a question? post at [StackOverflow](https://stackoverflow.com/questions/tagged/lcss2php websemantics)., (*9)

Please don't use the issue trackers for support/questions., (*10)

Contribution

Contributions to this project are accepted in the form of feedback, bugs reports and even better - pull requests., (*11)

Open Source

These project have been used in the making of this project, thanks you!, (*12)

License

MIT license Copyright (c) Web Semantics, Inc., (*13)

The Versions

03/01 2018

dev-master

9999999-dev https://github.com/websemantics/lcss2php

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms

03/01 2018

1.0.4

1.0.4.0 https://github.com/websemantics/lcss2php

Conveniently extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms

24/11 2016

1.0.3

1.0.3.0 https://github.com/websemantics/lcss2php

Conveniently extracts SCSS and LESS variables and converts them into a PHP array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms

23/11 2016

1.0.2

1.0.2.0 https://github.com/websemantics/lcss2php

Conveniently extracts SCSS and LESS variables and converts them into a PHP array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms

23/11 2016

1.0.1

1.0.1.0 https://github.com/websemantics/lcss2php

Conveniently extracts SCSS and LESS variables and converts them into a PHP array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms

23/11 2016

1.0.0

1.0.0.0 https://github.com/websemantics/lcss2php

Conveniently extracts SCSS and LESS variables and converts them into a PHP array.

  Sources   Download

MIT

The Requires

 

laravel php less sass scss pyrocms