Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

No way to add CSS Options #14

Open
dwilbanks opened this issue Jan 4, 2017 · 5 comments
Open

No way to add CSS Options #14

dwilbanks opened this issue Jan 4, 2017 · 5 comments

Comments

@dwilbanks
Copy link

When Html->css is called on line 157, there is no way to set options.

I've made this small change which allows for setting Html->css options.

$cssOpt = isset($options['cssopt'] )?$options['cssopt']:[];
return $this->Html->css($css,$cssOpt);

@elboletaire
Copy link
Owner

Make a PR with the changes and I'll check them when I can.

Instead of naming the option cssopt name it css please. cssopt is cacophonous, as the variable is named options.

And instead of adding that ternary operator there, use the setOptions method to define an empty array for $options['css'] in case it's empty.

@dwilbanks
Copy link
Author

I've read up on define:cacophonous. Google was very helpful in describing what you mean. I don't have a particular love for ['cssopt'], however, ['css'] is not descriptive enough when the entire project revolves around the topic of css. How do you feel about ['css_options'] ?

I will read up on what's required to make a PR and do that as soon as I'm able.

@elboletaire
Copy link
Owner

elboletaire commented Jan 4, 2017

If the variable is named options, why want you to name it $options['css_options']? I think is very descriptive to say $options['css'], moreover when there are no other css options that can be confused with this.

Maybe $options['cssTag'] is what you're searching for, but, again, I think there's no need to complicate the variable when there are no more css options involved.

@dwilbanks
Copy link
Author

I very much appreciate the work that you've done to get us this far and don't want to seem ungrateful.

I suspect that after this submit, I'll never look at this code again. We can name all the variables css, and I'll sleep just fine. My only desire was to clean up all the sludge getting created in my css directory on my personal development server.

I'll explain my reason, but, honestly I don't care what it gets called.

$this->less() gets called with $options, $options contains $options['parser'] , which is passed into $this->compile() and used as $options. So, $options['parser'] becomes $options in the compile context. When those options are actually used, they are passed to \Less_Cache::Get() and used as $parser_options which makes sense to me. I think that instead of being called $options inside the $this->compile() method, it should be called $parser_options, which is a more descriptive and and more consistent with it's usage.

the method $this->Html->css() needs to get some options too and that's what we're discussing. Maybe ['HTMLoptions'] would be more palatable to you because it's being passed to the HTML helper, I don't think ['cssTag'] is at all descriptive of what the property is supposed to do, but, once again, I don't care.

I'll sleep just fine regardless of what it's called.

@elboletaire
Copy link
Owner

I wont sleep fine if I name it HTMLoptions, sorry 😅 .

Let's name it just $options['css'].

However, I take into account your comments for the SASS version, which I would like to create soon or later.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants