websemantics / lcss2php

A straightforward library that extracts variable declarations from multiple Less / Scss sources and returns a PHP associative array.
MIT License
3 stars 1 forks source link

[bug] Broke something or the other… #2

Closed daviesgeek closed 7 years ago

daviesgeek commented 7 years ago

In developing my own theme for Pyro, I somehow managed to break the less compiler.

It errors out here: https://github.com/websemantics/lcss2php/blob/755c489b9754b062c9c5c884742d72a492219e07/src/Compiler/LessCompiler.php#L30

If i add a check before that line (if (is_array($root->_variables)) {..., then it all works correctly...

I've included some relevant files. I can provide more if needed.

laravel-2016-11-24.txt variables.less.txt variables.php.txt

ThinkGraphical commented 7 years ago

I'm experiencing a related issue in SCSS. It can't seem to find any of the bootstrap variables.

When using the PyroCMS Plus theme for example, i get the following error:

An exception has been thrown during the rendering of a template ("Undefined variable $brand-primary: line: 12") in "theme::partials/metadata" at line 24.

Extra info: Worked fine before, but after running composer update it broke.

websemantics commented 7 years ago

I made a change last night to fix issues with the scss compiler, that might caused it

But meanwhile, few notes, by default, the variables are expecte to be either in resources/less/theme/variables.less or resources/scss/theme/_variables.scss

If that's not the case, or If you need to have access to more variables, add this line to the theme config @ resources/config/config.php

'variables' => env('THEME_VARIABLES', ['resources/less/theme/variables.less']),

It's a list of all files that your theme requires access to the variables. Best if all the ones required by Pyro plugins (often it's field types) should be in the theme main variables file,

I will make few tests and get back,

websemantics commented 7 years ago

Also, make sure you're working from 1.1 because you will need this,

https://github.com/anomalylabs/streams-platform/blob/1.1/src/Asset/Command/LoadThemeVariables.php#L75

websemantics commented 7 years ago

@daviesgeek, try without the single quote,

@brand-primary: #2c3e50;
@brand-success: #24ce7b;
@brand-info: #38b5e6;
@brand-warning: #f69630;
@brand-danger: #f6303e;

I just updated stone-theme to work with the new changes, it uses less so could be a good example,

websemantics commented 7 years ago

@ThinkGraphical, just update https://github.com/websemantics/pyrocms-theme, it should work fine now,

Closing this, reopen if the issues haven't been resolved completely.